home *** CD-ROM | disk | FTP | other *** search
/ Whiteline: Alpha / Whiteline Alpha.iso / progtool / c / gcc / gcc258s.zoo / toplev.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-30  |  98.5 KB  |  3,759 lines

  1. /* Top level of GNU C compiler
  2.    Copyright (C) 1987, 1988, 1989, 1992, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
  19.  
  20.  
  21. /* This is the top level of cc1/c++.
  22.    It parses command args, opens files, invokes the various passes
  23.    in the proper order, and counts the time used by each.
  24.    Error messages and low-level interface to malloc also handled here.  */
  25.  
  26. #include "config.h"
  27. #include <sys/types.h>
  28. #include <stdio.h>
  29. #include <signal.h>
  30. #include <setjmp.h>
  31.  
  32. #include <sys/stat.h>
  33.  
  34. #if defined(USG) || defined(CROSSHPUX)
  35. #undef FLOAT
  36. #include <sys/param.h>
  37. /* This is for hpux.  It is a real screw.  They should change hpux.  */
  38. #undef FLOAT
  39. #include <sys/times.h>
  40. #include <time.h>   /* Correct for hpux at least.  Is it good on other USG?  */
  41. #undef FFS  /* Some systems define this in param.h.  */
  42. #else
  43. #ifndef VMS
  44. #if (!(defined(atarist) || defined(atariminix)))
  45. #include <sys/time.h>
  46. #include <sys/resource.h>
  47. #endif /* !(atarist || atariminix) */
  48. #endif
  49. #endif
  50.  
  51. #ifdef atariminix
  52. #include <sys/times.h>
  53. /* #include <minix/const.h>, avoid dragging this in */
  54. #define HZ 60    /* this is the only thing needed from minix/const.h */
  55. #endif
  56.  
  57. #include "input.h"
  58. #include "tree.h"
  59. /* #include "c-tree.h" */
  60. #include "rtl.h"
  61. #include "flags.h"
  62. #include "insn-attr.h"
  63. #include "defaults.h"
  64.  
  65. #ifdef XCOFF_DEBUGGING_INFO
  66. #include "xcoffout.h"
  67. #endif
  68.  
  69. #include "bytecode.h"
  70. #include "bc-emit.h"
  71.  
  72. #ifdef atarist
  73. long _stksize = -1L;    /* for all sizes of ST's */
  74.     /* -1 means malloc from own heap and keep all  of memory */
  75. #endif /* atarist */
  76.  
  77. #ifdef VMS
  78. /* The extra parameters substantially improve the I/O performance.  */
  79. static FILE *
  80. VMS_fopen (fname, type)
  81.      char * fname;
  82.      char * type;
  83. {
  84.   if (strcmp (type, "w") == 0)
  85.     return fopen (fname, type, "mbc=16", "deq=64", "fop=tef", "shr=nil");
  86.   return fopen (fname, type, "mbc=16");
  87. }
  88. #define fopen VMS_fopen
  89. #endif
  90.  
  91. #ifndef DEFAULT_GDB_EXTENSIONS
  92. #define DEFAULT_GDB_EXTENSIONS 1
  93. #endif
  94.  
  95. extern int rtx_equal_function_value_matters;
  96.  
  97. #if ! (defined (VMS) || defined (OS2))
  98. extern char **environ;
  99. #endif
  100. extern char *version_string, *language_string;
  101.  
  102. /* Carry information from ASM_DECLARE_OBJECT_NAME
  103.    to ASM_FINISH_DECLARE_OBJECT.  */
  104.  
  105. extern int size_directive_output;
  106. extern tree last_assemble_variable_decl;
  107.  
  108. extern void init_lex ();
  109. extern void init_decl_processing ();
  110. extern void init_obstacks ();
  111. extern void init_tree_codes ();
  112. extern void init_rtl ();
  113. extern void init_optabs ();
  114. extern void init_stmt ();
  115. extern void init_reg_sets ();
  116. extern void dump_flow_info ();
  117. extern void dump_sched_info ();
  118. extern void dump_local_alloc ();
  119.  
  120. void rest_of_decl_compilation ();
  121. void error ();
  122. void error_with_file_and_line ();
  123. void fancy_abort ();
  124. #ifndef abort
  125. void abort ();
  126. #endif
  127. void set_target_switch ();
  128. static void print_switch_values ();
  129. static char *decl_name ();
  130.  
  131. /* Name of program invoked, sans directories.  */
  132.  
  133. char *progname;
  134.  
  135. /* Copy of arguments to main.  */
  136. int save_argc;
  137. char **save_argv;
  138.  
  139. /* Name of current original source file (what was input to cpp).
  140.    This comes from each #-command in the actual input.  */
  141.  
  142. char *input_filename;
  143.  
  144. /* Name of top-level original source file (what was input to cpp).
  145.    This comes from the #-command at the beginning of the actual input.
  146.    If there isn't any there, then this is the cc1 input file name.  */
  147.  
  148. char *main_input_filename;
  149.  
  150. /* Stream for reading from the input file.  */
  151.  
  152. FILE *finput;
  153.  
  154. /* Current line number in real source file.  */
  155.  
  156. int lineno;
  157.  
  158. /* Stack of currently pending input files.  */
  159.  
  160. struct file_stack *input_file_stack;
  161.  
  162. /* Incremented on each change to input_file_stack.  */
  163. int input_file_stack_tick;
  164.  
  165. /* FUNCTION_DECL for function now being parsed or compiled.  */
  166.  
  167. extern tree current_function_decl;
  168.  
  169. /* Name to use as base of names for dump output files.  */
  170.  
  171. char *dump_base_name;
  172.  
  173. /* Bit flags that specify the machine subtype we are compiling for.
  174.    Bits are tested using macros TARGET_... defined in the tm.h file
  175.    and set by `-m...' switches.  Must be defined in rtlanal.c.  */
  176.  
  177. extern int target_flags;
  178.  
  179. /* Flags saying which kinds of debugging dump have been requested.  */
  180.  
  181. int rtl_dump = 0;
  182. int rtl_dump_and_exit = 0;
  183. int jump_opt_dump = 0;
  184. int cse_dump = 0;
  185. int loop_dump = 0;
  186. int cse2_dump = 0;
  187. int flow_dump = 0;
  188. int combine_dump = 0;
  189. int sched_dump = 0;
  190. int local_reg_dump = 0;
  191. int global_reg_dump = 0;
  192. int sched2_dump = 0;
  193. int jump2_opt_dump = 0;
  194. int dbr_sched_dump = 0;
  195. int flag_print_asm_name = 0;
  196. int stack_reg_dump = 0;
  197.  
  198. /* Name for output file of assembly code, specified with -o.  */
  199.  
  200. char *asm_file_name;
  201.  
  202. /* Value of the -G xx switch, and whether it was passed or not.  */
  203. int g_switch_value;
  204. int g_switch_set;
  205.  
  206. /* Type(s) of debugging information we are producing (if any).
  207.    See flags.h for the definitions of the different possible
  208.    types of debugging information.  */
  209. enum debug_info_type write_symbols = NO_DEBUG;
  210.  
  211. /* Level of debugging information we are producing.  See flags.h
  212.    for the definitions of the different possible levels.  */
  213. enum debug_info_level debug_info_level = DINFO_LEVEL_NONE;
  214.  
  215. /* Nonzero means use GNU-only extensions in the generated symbolic
  216.    debugging information.  */
  217. /* Currently, this only has an effect when write_symbols is set to
  218.    DBX_DEBUG, XCOFF_DEBUG, or DWARF_DEBUG.  */
  219. int use_gnu_debug_info_extensions = 0;
  220.  
  221. /* Nonzero means do optimizations.  -O.
  222.    Particular numeric values stand for particular amounts of optimization;
  223.    thus, -O2 stores 2 here.  However, the optimizations beyond the basic
  224.    ones are not controlled directly by this variable.  Instead, they are
  225.    controlled by individual `flag_...' variables that are defaulted
  226.    based on this variable.  */
  227.  
  228. int optimize = 0;
  229.  
  230. /* Number of error messages and warning messages so far.  */
  231.  
  232. int errorcount = 0;
  233. int warningcount = 0;
  234. int sorrycount = 0;
  235.  
  236. /* Flag to output bytecode instead of native assembler */
  237. int output_bytecode = 0;
  238.  
  239. /* Pointer to function to compute the name to use to print a declaration.  */
  240.  
  241. char *(*decl_printable_name) ();
  242.  
  243. /* Pointer to function to compute rtl for a language-specific tree code.  */
  244.  
  245. struct rtx_def *(*lang_expand_expr) ();
  246.  
  247. /* Pointer to function to finish handling an incomplete decl at the
  248.    end of compilation.  */
  249.  
  250. void (*incomplete_decl_finalize_hook) () = 0;
  251.  
  252. /* Nonzero if generating code to do profiling.  */
  253.  
  254. int profile_flag = 0;
  255.  
  256. /* Nonzero if generating code to do profiling on a line-by-line basis.  */
  257.  
  258. int profile_block_flag;
  259.  
  260. /* Nonzero for -pedantic switch: warn about anything
  261.    that standard spec forbids.  */
  262.  
  263. int pedantic = 0;
  264.  
  265. /* Temporarily suppress certain warnings.
  266.    This is set while reading code from a system header file.  */
  267.  
  268. int in_system_header = 0;
  269.  
  270. /* Nonzero means do stupid register allocation.
  271.    Currently, this is 1 if `optimize' is 0.  */
  272.  
  273. int obey_regdecls = 0;
  274.  
  275. /* Don't print functions as they are compiled and don't print
  276.    times taken by the various passes.  -quiet.  */
  277.  
  278. int quiet_flag = 0;
  279.  
  280. /* -f flags.  */
  281.  
  282. /* Nonzero means `char' should be signed.  */
  283.  
  284. int flag_signed_char;
  285.  
  286. /* Nonzero means give an enum type only as many bytes as it needs.  */
  287.  
  288. int flag_short_enums;
  289.  
  290. /* Nonzero for -fcaller-saves: allocate values in regs that need to
  291.    be saved across function calls, if that produces overall better code.
  292.    Optional now, so people can test it.  */
  293.  
  294. #ifdef DEFAULT_CALLER_SAVES
  295. int flag_caller_saves = 1;
  296. #else
  297. int flag_caller_saves = 0;
  298. #endif
  299.  
  300. /* Nonzero if structures and unions should be returned in memory.
  301.  
  302.    This should only be defined if compatibility with another compiler or
  303.    with an ABI is needed, because it results in slower code.  */
  304.  
  305. #ifndef DEFAULT_PCC_STRUCT_RETURN
  306. #define DEFAULT_PCC_STRUCT_RETURN 1
  307. #endif
  308.  
  309. /* Nonzero for -fpcc-struct-return: return values the same way PCC does.  */
  310.  
  311. int flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN;
  312.  
  313. /* Nonzero for -fforce-mem: load memory value into a register
  314.    before arithmetic on it.  This makes better cse but slower compilation.  */
  315.  
  316. int flag_force_mem = 0;
  317.  
  318. /* Nonzero for -fforce-addr: load memory address into a register before
  319.    reference to memory.  This makes better cse but slower compilation.  */
  320.  
  321. int flag_force_addr = 0;
  322.  
  323. /* Nonzero for -fdefer-pop: don't pop args after each function call;
  324.    instead save them up to pop many calls' args with one insns.  */
  325.  
  326. int flag_defer_pop = 0;
  327.  
  328. /* Nonzero for -ffloat-store: don't allocate floats and doubles
  329.    in extended-precision registers.  */
  330.  
  331. int flag_float_store = 0;
  332.  
  333. /* Nonzero for -fcse-follow-jumps:
  334.    have cse follow jumps to do a more extensive job.  */
  335.  
  336. int flag_cse_follow_jumps;
  337.  
  338. /* Nonzero for -fcse-skip-blocks:
  339.    have cse follow a branch around a block.  */
  340. int flag_cse_skip_blocks;
  341.  
  342. /* Nonzero for -fexpensive-optimizations:
  343.    perform miscellaneous relatively-expensive optimizations.  */
  344. int flag_expensive_optimizations;
  345.  
  346. /* Nonzero for -fthread-jumps:
  347.    have jump optimize output of loop.  */
  348.  
  349. int flag_thread_jumps;
  350.  
  351. /* Nonzero enables strength-reduction in loop.c.  */
  352.  
  353. int flag_strength_reduce = 0;
  354.  
  355. /* Nonzero enables loop unrolling in unroll.c.  Only loops for which the
  356.    number of iterations can be calculated at compile-time (UNROLL_COMPLETELY,
  357.    UNROLL_MODULO) or at run-time (preconditioned to be UNROLL_MODULO) are
  358.    unrolled.  */
  359.  
  360. int flag_unroll_loops;
  361.  
  362. /* Nonzero enables loop unrolling in unroll.c.  All loops are unrolled.
  363.    This is generally not a win.  */
  364.  
  365. int flag_unroll_all_loops;
  366.  
  367. /* Nonzero for -fwritable-strings:
  368.    store string constants in data segment and don't uniquize them.  */
  369.  
  370. int flag_writable_strings = 0;
  371.  
  372. /* Nonzero means don't put addresses of constant functions in registers.
  373.    Used for compiling the Unix kernel, where strange substitutions are
  374.    done on the assembly output.  */
  375.  
  376. int flag_no_function_cse = 0;
  377.  
  378. /* Nonzero for -fomit-frame-pointer:
  379.    don't make a frame pointer in simple functions that don't require one.  */
  380.  
  381. int flag_omit_frame_pointer = 0;
  382.  
  383. /* Nonzero to inhibit use of define_optimization peephole opts.  */
  384.  
  385. int flag_no_peephole = 0;
  386.  
  387. /* Nonzero allows GCC to violate some IEEE or ANSI rules regarding math
  388.    operations in the interest of optimization.  For example it allows
  389.    GCC to assume arguments to sqrt are nonnegative numbers, allowing
  390.    faster code for sqrt to be generated. */
  391.  
  392. int flag_fast_math = 0;
  393.  
  394. /* Nonzero means all references through pointers are volatile.  */
  395.  
  396. int flag_volatile;
  397.  
  398. /* Nonzero means treat all global and extern variables as global.  */
  399.  
  400. int flag_volatile_global;
  401.  
  402. /* Nonzero means just do syntax checking; don't output anything.  */
  403.  
  404. int flag_syntax_only = 0;
  405.  
  406. /* Nonzero means to rerun cse after loop optimization.  This increases
  407.    compilation time about 20% and picks up a few more common expressions.  */
  408.  
  409. static int flag_rerun_cse_after_loop;
  410.  
  411. /* Nonzero for -finline-functions: ok to inline functions that look like
  412.    good inline candidates.  */
  413.  
  414. int flag_inline_functions;
  415.  
  416. /* Nonzero for -fkeep-inline-functions: even if we make a function
  417.    go inline everywhere, keep its definition around for debugging
  418.    purposes.  */
  419.  
  420. int flag_keep_inline_functions;
  421.  
  422. /* Nonzero means that functions declared `inline' will be treated
  423.    as `static'.  Prevents generation of zillions of copies of unused
  424.    static inline functions; instead, `inlines' are written out
  425.    only when actually used.  Used in conjunction with -g.  Also
  426.    does the right thing with #pragma interface.  */
  427.  
  428. int flag_no_inline;
  429.  
  430. /* Nonzero means we should be saving declaration info into a .X file.  */
  431.  
  432. int flag_gen_aux_info = 0;
  433.  
  434. /* Specified name of aux-info file.  */
  435.  
  436. static char *aux_info_file_name;
  437.  
  438. /* Nonzero means make the text shared if supported.  */
  439.  
  440. int flag_shared_data;
  441.  
  442. /* Nonzero means schedule into delayed branch slots if supported.  */
  443.  
  444. int flag_delayed_branch;
  445.  
  446. /* Nonzero if we are compiling pure (sharable) code.
  447.    Value is 1 if we are doing reasonable (i.e. simple
  448.    offset into offset table) pic.  Value is 2 if we can
  449.    only perform register offsets.  */
  450.  
  451. int flag_pic;
  452.  
  453. /* Nonzero means place uninitialized global data in the bss section. */
  454.  
  455. int flag_no_common;
  456.  
  457. /* Nonzero means pretend it is OK to examine bits of target floats,
  458.    even if that isn't true.  The resulting code will have incorrect constants,
  459.    but the same series of instructions that the native compiler would make.  */
  460.  
  461. int flag_pretend_float;
  462.  
  463. /* Nonzero means change certain warnings into errors.
  464.    Usually these are warnings about failure to conform to some standard.  */
  465.  
  466. int flag_pedantic_errors = 0;
  467.  
  468. /* flag_schedule_insns means schedule insns within basic blocks (before
  469.    local_alloc).
  470.    flag_schedule_insns_after_reload means schedule insns after
  471.    global_alloc.  */
  472.  
  473. int flag_schedule_insns = 0;
  474. int flag_schedule_insns_after_reload = 0;
  475.  
  476. /* -finhibit-size-directive inhibits output of .size for ELF.
  477.    This is used only for compiling crtstuff.c, 
  478.    and it may be extended to other effects
  479.    needed for crtstuff.c on other systems.  */
  480. int flag_inhibit_size_directive = 0;
  481.  
  482. /* -fverbose-asm causes extra commentary information to be produced in
  483.    the generated assembly code (to make it more readable).  This option
  484.    is generally only of use to those who actually need to read the
  485.    generated assembly code (perhaps while debugging the compiler itself).  */
  486.  
  487. int flag_verbose_asm = 0;
  488.  
  489. /* -fgnu-linker specifies use of the GNU linker for initializations.
  490.    (Or, more generally, a linker that handles initializations.)
  491.    -fno-gnu-linker says that collect2 will be used.  */
  492. #ifdef USE_COLLECT2
  493. int flag_gnu_linker = 0;
  494. #else
  495. int flag_gnu_linker = 1;
  496. #endif
  497.  
  498. /* Table of language-independent -f options.
  499.    STRING is the option name.  VARIABLE is the address of the variable.
  500.    ON_VALUE is the value to store in VARIABLE
  501.     if `-fSTRING' is seen as an option.
  502.    (If `-fno-STRING' is seen as an option, the opposite value is stored.)  */
  503.  
  504. struct { char *string; int *variable; int on_value;} f_options[] =
  505. {
  506.   {"float-store", &flag_float_store, 1},
  507.   {"volatile", &flag_volatile, 1},
  508.   {"volatile-global", &flag_volatile_global, 1},
  509.   {"defer-pop", &flag_defer_pop, 1},
  510.   {"omit-frame-pointer", &flag_omit_frame_pointer, 1},
  511.   {"cse-follow-jumps", &flag_cse_follow_jumps, 1},
  512.   {"cse-skip-blocks", &flag_cse_skip_blocks, 1},
  513.   {"expensive-optimizations", &flag_expensive_optimizations, 1},
  514.   {"thread-jumps", &flag_thread_jumps, 1},
  515.   {"strength-reduce", &flag_strength_reduce, 1},
  516.   {"unroll-loops", &flag_unroll_loops, 1},
  517.   {"unroll-all-loops", &flag_unroll_all_loops, 1},
  518.   {"writable-strings", &flag_writable_strings, 1},
  519.   {"peephole", &flag_no_peephole, 0},
  520.   {"force-mem", &flag_force_mem, 1},
  521.   {"force-addr", &flag_force_addr, 1},
  522.   {"function-cse", &flag_no_function_cse, 0},
  523.   {"inline-functions", &flag_inline_functions, 1},
  524.   {"keep-inline-functions", &flag_keep_inline_functions, 1},
  525.   {"inline", &flag_no_inline, 0},
  526.   {"syntax-only", &flag_syntax_only, 1},
  527.   {"shared-data", &flag_shared_data, 1},
  528.   {"caller-saves", &flag_caller_saves, 1},
  529.   {"pcc-struct-return", &flag_pcc_struct_return, 1},
  530.   {"reg-struct-return", &flag_pcc_struct_return, 0},
  531.   {"delayed-branch", &flag_delayed_branch, 1},
  532.   {"rerun-cse-after-loop", &flag_rerun_cse_after_loop, 1},
  533.   {"pretend-float", &flag_pretend_float, 1},
  534.   {"schedule-insns", &flag_schedule_insns, 1},
  535.   {"schedule-insns2", &flag_schedule_insns_after_reload, 1},
  536.   {"pic", &flag_pic, 1},
  537.   {"PIC", &flag_pic, 2},
  538.   {"fast-math", &flag_fast_math, 1},
  539.   {"common", &flag_no_common, 0},
  540.   {"inhibit-size-directive", &flag_inhibit_size_directive, 1},
  541.   {"verbose-asm", &flag_verbose_asm, 1},
  542.   {"gnu-linker", &flag_gnu_linker, 1},
  543.   {"bytecode", &output_bytecode, 1}
  544. };
  545.  
  546. /* Table of language-specific options.  */
  547.  
  548. char *lang_options[] =
  549. {
  550.   "-ftraditional",
  551.   "-traditional",
  552.   "-fnotraditional",
  553.   "-fno-traditional",
  554.   "-fallow-single-precision",
  555.   "-fsigned-char",
  556.   "-funsigned-char",
  557.   "-fno-signed-char",
  558.   "-fno-unsigned-char",
  559.   "-fsigned-bitfields",
  560.   "-funsigned-bitfields",
  561.   "-fno-signed-bitfields",
  562.   "-fno-unsigned-bitfields",
  563.   "-fshort-enums",
  564.   "-fno-short-enums",
  565.   "-fcond-mismatch",
  566.   "-fno-cond-mismatch",
  567.   "-fshort-double",
  568.   "-fno-short-double",
  569.   "-fasm",
  570.   "-fno-asm",
  571.   "-fbuiltin",
  572.   "-fno-builtin",
  573.   "-fno-ident",
  574.   "-fident",
  575.   "-fdollars-in-identifiers",
  576.   "-fno-dollars-in-identifiers",
  577.   "-ansi",
  578.   "-Wimplicit",
  579.   "-Wno-implicit",
  580.   "-Wwrite-strings",
  581.   "-Wno-write-strings",
  582.   "-Wcast-qual",
  583.   "-Wno-cast-qual",
  584.   "-Wpointer-arith",
  585.   "-Wno-pointer-arith",
  586.   "-Wstrict-prototypes",
  587.   "-Wno-strict-prototypes",
  588.   "-Wmissing-prototypes",
  589.   "-Wno-missing-prototypes",
  590.   "-Wredundant-decls",
  591.   "-Wno-redundant-decls",
  592.   "-Wnested-externs",
  593.   "-Wno-nested-externs",
  594.   "-Wtraditional",
  595.   "-Wno-traditional",
  596.   "-Wformat",
  597.   "-Wno-format",
  598.   "-Wchar-subscripts",
  599.   "-Wno-char-subscripts",
  600.   "-Wconversion",
  601.   "-Wno-conversion",
  602.   "-Wparentheses",
  603.   "-Wno-parentheses",
  604.   "-Wcomment",
  605.   "-Wno-comment",
  606.   "-Wcomments",
  607.   "-Wno-comments",
  608.   "-Wtrigraphs",
  609.   "-Wno-trigraphs",
  610.   "-Wimport",
  611.   "-Wno-import",
  612.   "-Wmissing-braces",
  613.   "-Wno-missing-braces",
  614.   "-Wall",
  615.  
  616.   /* These are for C++.  */
  617.   "-+e0",            /* gcc.c tacks the `-' on the front.  */
  618.   "-+e1",
  619.   "-+e2",
  620.   "-fsave-memoized",
  621.   "-fno-save-memoized",
  622.   "-fcadillac",
  623.   "-fno-cadillac",
  624.   "-fgc",
  625.   "-fno-gc",
  626.   "-flabels-ok",
  627.   "-fno-labels-ok",
  628.   "-fstats",
  629.   "-fno-stats",
  630.   "-fthis-is-variable",
  631.   "-fno-this-is-variable",
  632.   "-fstrict-prototype",
  633.   "-fno-strict-prototype",
  634.   "-fall-virtual",
  635.   "-fno-all-virtual",
  636.   "-fmemoize-lookups",
  637.   "-fno-memoize-lookups",
  638.   "-felide-constructors",
  639.   "-fno-elide-constructors",
  640.   "-fhandle-exceptions",
  641.   "-fno-handle-exceptions",
  642.   "-fansi-exceptions",
  643.   "-fno-ansi-exceptions",
  644.   "-fspring-exceptions",
  645.   "-fno-spring-exceptions",
  646.   "-fdefault-inline",
  647.   "-fno-default-inline",
  648.   "-fenum-int-equiv",
  649.   "-fno-enum-int-equiv",
  650.   "-fdossier",
  651.   "-fno-dossier",
  652.   "-fxref",
  653.   "-fno-xref",
  654.   "-fnonnull-objects",
  655.   "-fno-nonnull-objects",
  656.   "-fimplement-inlines",
  657.   "-fno-implement-inlines",
  658.   "-fexternal-templates",
  659.   "-fno-external-templates",
  660.   "-fansi-overloading",
  661.   "-fno-ansi-overloading",
  662.  
  663.   "-Wreturn-type",
  664.   "-Wno-return-type",
  665.   "-Woverloaded-virtual",
  666.   "-Wno-overloaded-virtual",
  667.   "-Wenum-clash",
  668.   "-Wno-enum-clash",
  669.   "-Wtemplate-debugging",
  670.   "-Wno-template-debugging",
  671.   "-Wctor-dtor-privacy",
  672.   "-Wno-ctor-dtor-privacy",
  673.  
  674.   /* these are for obj c */
  675.   "-lang-objc",
  676.   "-gen-decls",
  677.   "-fgnu-runtime",
  678.   "-fno-gnu-runtime",
  679.   "-fnext-runtime",
  680.   "-fno-next-runtime",
  681.   "-Wselector",
  682.   "-Wno-selector",
  683.   "-Wprotocol",
  684.   "-Wno-protocol",
  685.  
  686.   /* This is for GNAT and is temporary.  */
  687.   "-gnat",
  688.   0
  689. };
  690.  
  691. /* Options controlling warnings */
  692.  
  693. /* Don't print warning messages.  -w.  */
  694.  
  695. int inhibit_warnings = 0;
  696.  
  697. /* Print various extra warnings.  -W.  */
  698.  
  699. int extra_warnings = 0;
  700.  
  701. /* Treat warnings as errors.  -Werror.  */
  702.  
  703. int warnings_are_errors = 0;
  704.  
  705. /* Nonzero to warn about unused local variables.  */
  706.  
  707. int warn_unused;
  708.  
  709. /* Nonzero to warn about variables used before they are initialized.  */
  710.  
  711. int warn_uninitialized;
  712.  
  713. /* Nonzero means warn about all declarations which shadow others.   */
  714.  
  715. int warn_shadow;
  716.  
  717. /* Warn if a switch on an enum fails to have a case for every enum value.  */
  718.  
  719. int warn_switch;
  720.  
  721. /* Nonzero means warn about function definitions that default the return type
  722.    or that use a null return and have a return-type other than void.  */
  723.  
  724. int warn_return_type;
  725.  
  726. /* Nonzero means warn about pointer casts that increase the required
  727.    alignment of the target type (and might therefore lead to a crash
  728.    due to a misaligned access).  */
  729.  
  730. int warn_cast_align;
  731.  
  732. /* Nonzero means warn about any identifiers that match in the first N
  733.    characters.  The value N is in `id_clash_len'.  */
  734.  
  735. int warn_id_clash;
  736. int id_clash_len;
  737.  
  738. /* Nonzero means warn if inline function is too large.  */
  739.  
  740. int warn_inline;
  741.  
  742. /* Warn if a function returns an aggregate,
  743.    since there are often incompatible calling conventions for doing this.  */
  744.  
  745. int warn_aggregate_return;
  746.  
  747. /* Likewise for -W.  */
  748.  
  749. struct { char *string; int *variable; int on_value;} W_options[] =
  750. {
  751.   {"unused", &warn_unused, 1},
  752.   {"error", &warnings_are_errors, 1},
  753.   {"shadow", &warn_shadow, 1},
  754.   {"switch", &warn_switch, 1},
  755.   {"aggregate-return", &warn_aggregate_return, 1},
  756.   {"cast-align", &warn_cast_align, 1},
  757.   {"uninitialized", &warn_uninitialized, 1},
  758.   {"inline", &warn_inline, 1}
  759. };
  760.  
  761. /* Output files for assembler code (real compiler output)
  762.    and debugging dumps.  */
  763.  
  764. FILE *asm_out_file;
  765. FILE *aux_info_file;
  766. FILE *rtl_dump_file;
  767. FILE *jump_opt_dump_file;
  768. FILE *cse_dump_file;
  769. FILE *loop_dump_file;
  770. FILE *cse2_dump_file;
  771. FILE *flow_dump_file;
  772. FILE *combine_dump_file;
  773. FILE *sched_dump_file;
  774. FILE *local_reg_dump_file;
  775. FILE *global_reg_dump_file;
  776. FILE *sched2_dump_file;
  777. FILE *jump2_opt_dump_file;
  778. FILE *dbr_sched_dump_file;
  779. FILE *stack_reg_dump_file;
  780.  
  781. /* Time accumulators, to count the total time spent in various passes.  */
  782.  
  783. int parse_time;
  784. int varconst_time;
  785. int integration_time;
  786. int jump_time;
  787. int cse_time;
  788. int loop_time;
  789. int cse2_time;
  790. int flow_time;
  791. int combine_time;
  792. int sched_time;
  793. int local_alloc_time;
  794. int global_alloc_time;
  795. int sched2_time;
  796. int dbr_sched_time;
  797. int shorten_branch_time;
  798. int stack_reg_time;
  799. int final_time;
  800. int symout_time;
  801. int dump_time;
  802.  
  803. /* Return time used so far, in microseconds.  */
  804.  
  805. int
  806. get_run_time ()
  807. {
  808. #ifdef atarist
  809.   long now;
  810. #else
  811. #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
  812.   struct tms tms;
  813. #else
  814. #ifndef VMS
  815.   struct rusage rusage;
  816. #else /* VMS */
  817.   struct
  818.     {
  819.       int proc_user_time;
  820.       int proc_system_time;
  821.       int child_user_time;
  822.       int child_system_time;
  823.     } vms_times;
  824. #endif
  825. #endif
  826. #endif
  827.  
  828.   if (quiet_flag)
  829.     return 0;
  830.  
  831. #ifdef atarist
  832.   return(time(NULL) * 1000000);
  833. #else
  834. #if (defined(USG) || defined(atariminix) || defined(CROSSHPUX))
  835.   times (&tms);
  836.   return (tms.tms_utime + tms.tms_stime) * (1000000 / HZ);
  837. #else
  838. #ifndef VMS
  839.   getrusage (0, &rusage);
  840.   return (rusage.ru_utime.tv_sec * 1000000 + rusage.ru_utime.tv_usec
  841.       + rusage.ru_stime.tv_sec * 1000000 + rusage.ru_stime.tv_usec);
  842. #else /* VMS */
  843.   times (&vms_times);
  844.   return (vms_times.proc_user_time + vms_times.proc_system_time) * 10000;
  845. #endif
  846. #endif
  847. #endif
  848. }
  849.  
  850. #define TIMEVAR(VAR, BODY)    \
  851. do { int otime = get_run_time (); BODY; VAR += get_run_time () - otime; } while (0)
  852.  
  853. void
  854. print_time (str, total)
  855.      char *str;
  856.      int total;
  857. {
  858.   fprintf (stderr,
  859.        "time in %s: %d.%06d\n",
  860.        str, total / 1000000, total % 1000000);
  861. }
  862.  
  863. /* Count an error or warning.  Return 1 if the message should be printed.  */
  864.  
  865. int
  866. count_error (warningp)
  867.      int warningp;
  868. {
  869.   if (warningp && inhibit_warnings)
  870.     return 0;
  871.  
  872.   if (warningp && !warnings_are_errors)
  873.     warningcount++;
  874.   else
  875.     {
  876.       static int warning_message = 0;
  877.  
  878.       if (warningp && !warning_message)
  879.     {
  880.       fprintf (stderr, "%s: warnings being treated as errors\n", progname);
  881.       warning_message = 1;
  882.     }
  883.       errorcount++;
  884.     }
  885.  
  886.   return 1;
  887. }
  888.  
  889. /* Print a fatal error message.  NAME is the text.
  890.    Also include a system error message based on `errno'.  */
  891.  
  892. void
  893. pfatal_with_name (name)
  894.      char *name;
  895. {
  896.   fprintf (stderr, "%s: ", progname);
  897.   perror (name);
  898.   exit (35);
  899. }
  900.  
  901. void
  902. fatal_io_error (name)
  903.      char *name;
  904. {
  905.   fprintf (stderr, "%s: %s: I/O error\n", progname, name);
  906.   exit (35);
  907. }
  908.  
  909. /* Called to give a better error message when we don't have an insn to match
  910.    what we are looking for or if the insn's constraints aren't satisfied,
  911.    rather than just calling abort().  */
  912.  
  913. void
  914. fatal_insn_not_found (insn)
  915.      rtx insn;
  916. {
  917.   if (!output_bytecode)
  918.     {
  919.       if (INSN_CODE (insn) < 0)
  920.     error ("internal error--unrecognizable insn:", 0);
  921.       else
  922.     error ("internal error--insn does not satisfy its constraints:", 0);
  923.       debug_rtx (insn);
  924.     }
  925.   if (asm_out_file)
  926.     fflush (asm_out_file);
  927.   if (aux_info_file)
  928.     fflush (aux_info_file);
  929.   if (rtl_dump_file)
  930.     fflush (rtl_dump_file);
  931.   if (jump_opt_dump_file)
  932.     fflush (jump_opt_dump_file);
  933.   if (cse_dump_file)
  934.     fflush (cse_dump_file);
  935.   if (loop_dump_file)
  936.     fflush (loop_dump_file);
  937.   if (cse2_dump_file)
  938.     fflush (cse2_dump_file);
  939.   if (flow_dump_file)
  940.     fflush (flow_dump_file);
  941.   if (combine_dump_file)
  942.     fflush (combine_dump_file);
  943.   if (sched_dump_file)
  944.     fflush (sched_dump_file);
  945.   if (local_reg_dump_file)
  946.     fflush (local_reg_dump_file);
  947.   if (global_reg_dump_file)
  948.     fflush (global_reg_dump_file);
  949.   if (sched2_dump_file)
  950.     fflush (sched2_dump_file);
  951.   if (jump2_opt_dump_file)
  952.     fflush (jump2_opt_dump_file);
  953.   if (dbr_sched_dump_file)
  954.     fflush (dbr_sched_dump_file);
  955.   if (stack_reg_dump_file)
  956.     fflush (stack_reg_dump_file);
  957.   abort ();
  958. }
  959.  
  960. /* This is the default decl_printable_name function.  */
  961.  
  962. static char *
  963. decl_name (decl, kind)
  964.      tree decl;
  965.      char **kind;
  966. {
  967.   return IDENTIFIER_POINTER (DECL_NAME (decl));
  968. }
  969.  
  970. static int need_error_newline;
  971.  
  972. /* Function of last error message;
  973.    more generally, function such that if next error message is in it
  974.    then we don't have to mention the function name.  */
  975. static tree last_error_function = NULL;
  976.  
  977. /* Used to detect when input_file_stack has changed since last described.  */
  978. static int last_error_tick;
  979.  
  980. /* Called when the start of a function definition is parsed,
  981.    this function prints on stderr the name of the function.  */
  982.  
  983. void
  984. announce_function (decl)
  985.      tree decl;
  986. {
  987.   if (! quiet_flag)
  988.     {
  989.       char *junk;
  990.       if (rtl_dump_and_exit)
  991.     fprintf (stderr, "%s ", IDENTIFIER_POINTER (DECL_NAME (decl)));
  992.       else
  993.     fprintf (stderr, " %s", (*decl_printable_name) (decl, &junk));
  994.       fflush (stderr);
  995.       need_error_newline = 1;
  996.       last_error_function = current_function_decl;
  997.     }
  998. }
  999.  
  1000. /* Prints out, if necessary, the name of the current function
  1001.    which caused an error.  Called from all error and warning functions.  */
  1002.  
  1003. void
  1004. report_error_function (file)
  1005.      char *file;
  1006. {
  1007.   struct file_stack *p;
  1008.  
  1009.   if (need_error_newline)
  1010.     {
  1011.       fprintf (stderr, "\n");
  1012.       need_error_newline = 0;
  1013.     }
  1014.  
  1015.   if (last_error_function != current_function_decl)
  1016.     {
  1017.       char *kind = "function";
  1018.       if (current_function_decl != 0
  1019.       && TREE_CODE (TREE_TYPE (current_function_decl)) == METHOD_TYPE)
  1020.     kind = "method";
  1021.  
  1022.       if (file)
  1023.     fprintf (stderr, "%s: ", file);
  1024.  
  1025.       if (current_function_decl == NULL)
  1026.     fprintf (stderr, "At top level:\n");
  1027.       else
  1028.     {
  1029.       char *name = (*decl_printable_name) (current_function_decl, &kind);
  1030.       fprintf (stderr, "In %s `%s':\n", kind, name);
  1031.     }
  1032.  
  1033.       last_error_function = current_function_decl;
  1034.     }
  1035.   if (input_file_stack && input_file_stack->next != 0
  1036.       && input_file_stack_tick != last_error_tick)
  1037.     {
  1038.       fprintf (stderr, "In file included");
  1039.       for (p = input_file_stack->next; p; p = p->next)
  1040.     {
  1041.       fprintf (stderr, " from %s:%d", p->name, p->line);
  1042.       if (p->next)
  1043.         fprintf (stderr, ",\n                ");
  1044.     }
  1045.       fprintf (stderr, ":\n");
  1046.       last_error_tick = input_file_stack_tick;
  1047.     }
  1048. }
  1049.  
  1050. /* Report an error at the current line number.
  1051.    S is a string and ARGLIST are args for `printf'.  We use HOST_WIDE_INT
  1052.    as the type for these args assuming it is wide enough to hold a
  1053.    pointer.  This isn't terribly portable, but is the best we can do
  1054.    without vprintf universally available.  */
  1055.  
  1056. #define arglist a1, a2, a3
  1057. #define arglist_dcl HOST_WIDE_INT a1, a2, a3;
  1058.  
  1059. void
  1060. error (s, arglist)
  1061.      char *s;
  1062.      arglist_dcl
  1063. {
  1064.   error_with_file_and_line (input_filename, lineno, s, arglist);
  1065. }
  1066.  
  1067. /* Report an error at line LINE of file FILE.
  1068.    S and ARGLIST are a string and args for `printf'.  */
  1069.  
  1070. void
  1071. error_with_file_and_line (file, line, s, arglist)
  1072.      char *file;
  1073.      int line;
  1074.      char *s;
  1075.      arglist_dcl
  1076. {
  1077.   count_error (0);
  1078.  
  1079.   report_error_function (file);
  1080.  
  1081.   if (file)
  1082.     fprintf (stderr, "%s:%d: ", file, line);
  1083.   else
  1084.     fprintf (stderr, "%s: ", progname);
  1085.   fprintf (stderr, s, arglist);
  1086.  
  1087.   fprintf (stderr, "\n");
  1088. }
  1089.  
  1090. /* Report an error at the declaration DECL.
  1091.    S and V are a string and an arg which uses %s to substitute
  1092.    the declaration name.  */
  1093.  
  1094. void
  1095. error_with_decl (decl, s, v)
  1096.      tree decl;
  1097.      char *s;
  1098.      HOST_WIDE_INT v;
  1099. {
  1100.   char *junk;
  1101.   count_error (0);
  1102.  
  1103.   report_error_function (DECL_SOURCE_FILE (decl));
  1104.  
  1105.   fprintf (stderr, "%s:%d: ",
  1106.        DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
  1107.  
  1108.   if (DECL_NAME (decl))
  1109.     fprintf (stderr, s, (*decl_printable_name) (decl, &junk), v);
  1110.   else
  1111.     fprintf (stderr, s, "((anonymous))", v);
  1112.   fprintf (stderr, "\n");
  1113. }
  1114.  
  1115. /* Report an error at the line number of the insn INSN.
  1116.    S and ARGLIST are a string and args for `printf'.
  1117.    This is used only when INSN is an `asm' with operands,
  1118.    and each ASM_OPERANDS records its own source file and line.  */
  1119.  
  1120. void
  1121. error_for_asm (insn, s, arglist)
  1122.      rtx insn;
  1123.      char *s;
  1124.      arglist_dcl
  1125. {
  1126.   char *filename;
  1127.   int line;
  1128.   rtx body = PATTERN (insn);
  1129.   rtx asmop;
  1130.  
  1131.   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
  1132.   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
  1133.     asmop = SET_SRC (body);
  1134.   else if (GET_CODE (body) == ASM_OPERANDS)
  1135.     asmop = body;
  1136.   else if (GET_CODE (body) == PARALLEL
  1137.        && GET_CODE (XVECEXP (body, 0, 0)) == SET)
  1138.     asmop = SET_SRC (XVECEXP (body, 0, 0));
  1139.   else if (GET_CODE (body) == PARALLEL
  1140.        && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
  1141.     asmop = XVECEXP (body, 0, 0);
  1142.  
  1143.   filename = ASM_OPERANDS_SOURCE_FILE (asmop);
  1144.   line = ASM_OPERANDS_SOURCE_LINE (asmop);
  1145.  
  1146.   error_with_file_and_line (filename, line, s, arglist);
  1147. }
  1148.  
  1149. void
  1150. fatal (s, arglist)
  1151.      char *s;
  1152.      arglist_dcl
  1153. {
  1154.   error (s, arglist);
  1155.   exit (34);
  1156. }
  1157.  
  1158. /* Report a warning at line LINE.
  1159.    S and ARGLIST are a string and args for `printf'.  */
  1160.  
  1161. void
  1162. warning_with_file_and_line (file, line, s, arglist)
  1163.      char *file;
  1164.      int line;
  1165.      char *s;
  1166.      arglist_dcl
  1167. {
  1168.   if (count_error (1) == 0)
  1169.     return;
  1170.  
  1171.   report_error_function (file);
  1172.  
  1173.   if (file)
  1174.     fprintf (stderr, "%s:%d: ", file, line);
  1175.   else
  1176.     fprintf (stderr, "%s: ", progname);
  1177.  
  1178.   fprintf (stderr, "warning: ");
  1179.   fprintf (stderr, s, arglist);
  1180.   fprintf (stderr, "\n");
  1181. }
  1182.  
  1183. /* Report a warning at the current line number.
  1184.    S and ARGLIST are a string and args for `printf'.  */
  1185.  
  1186. void
  1187. warning (s, arglist)
  1188.      char *s;
  1189.      arglist_dcl
  1190. {
  1191.   warning_with_file_and_line (input_filename, lineno, s, arglist);
  1192. }
  1193.  
  1194. /* Report a warning at the declaration DECL.
  1195.    S is string which uses %s to substitute the declaration name.
  1196.    V is a second parameter that S can refer to.  */
  1197.  
  1198. void
  1199. warning_with_decl (decl, s, v)
  1200.      tree decl;
  1201.      char *s;
  1202.      HOST_WIDE_INT v;
  1203. {
  1204.   char *junk;
  1205.  
  1206.   if (count_error (1) == 0)
  1207.     return;
  1208.  
  1209.   report_error_function (DECL_SOURCE_FILE (decl));
  1210.  
  1211.   fprintf (stderr, "%s:%d: ",
  1212.        DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl));
  1213.  
  1214.   fprintf (stderr, "warning: ");
  1215.   if (DECL_NAME (decl))
  1216.     fprintf (stderr, s, (*decl_printable_name) (decl, &junk), v);
  1217.   else
  1218.     fprintf (stderr, s, "((anonymous))", v);
  1219.   fprintf (stderr, "\n");
  1220. }
  1221.  
  1222. /* Report a warning at the line number of the insn INSN.
  1223.    S and ARGLIST are a string and args for `printf'.
  1224.    This is used only when INSN is an `asm' with operands,
  1225.    and each ASM_OPERANDS records its own source file and line.  */
  1226.  
  1227. void
  1228. warning_for_asm (insn, s, arglist)
  1229.      rtx insn;
  1230.      char *s;
  1231.      arglist_dcl
  1232. {
  1233.   char *filename;
  1234.   int line;
  1235.   rtx body = PATTERN (insn);
  1236.   rtx asmop;
  1237.  
  1238.   /* Find the (or one of the) ASM_OPERANDS in the insn.  */
  1239.   if (GET_CODE (body) == SET && GET_CODE (SET_SRC (body)) == ASM_OPERANDS)
  1240.     asmop = SET_SRC (body);
  1241.   else if (GET_CODE (body) == ASM_OPERANDS)
  1242.     asmop = body;
  1243.   else if (GET_CODE (body) == PARALLEL
  1244.        && GET_CODE (XVECEXP (body, 0, 0)) == SET)
  1245.     asmop = SET_SRC (XVECEXP (body, 0, 0));
  1246.   else if (GET_CODE (body) == PARALLEL
  1247.        && GET_CODE (XVECEXP (body, 0, 0)) == ASM_OPERANDS)
  1248.     asmop = XVECEXP (body, 0, 0);
  1249.  
  1250.   filename = ASM_OPERANDS_SOURCE_FILE (asmop);
  1251.   line = ASM_OPERANDS_SOURCE_LINE (asmop);
  1252.  
  1253.   warning_with_file_and_line (filename, line, s, arglist);
  1254. }
  1255.  
  1256. /* These functions issue either warnings or errors depending on
  1257.    -pedantic-errors.  */
  1258.  
  1259. void
  1260. pedwarn (s, arglist)
  1261.      char *s;
  1262.      arglist_dcl
  1263. {
  1264.   if (flag_pedantic_errors)
  1265.     error (s, arglist);
  1266.   else
  1267.     warning (s, arglist);
  1268. }
  1269.  
  1270. void
  1271. pedwarn_with_decl (decl, s, v)
  1272.      tree decl;
  1273.      char *s;
  1274.      HOST_WIDE_INT v;
  1275. {
  1276.   if (flag_pedantic_errors)
  1277.     error_with_decl (decl, s, v);
  1278.   else
  1279.     warning_with_decl (decl, s, v);
  1280. }
  1281.  
  1282. void
  1283. pedwarn_with_file_and_line (file, line, s, arglist)
  1284.      char *file;
  1285.      int line;
  1286.      char *s;
  1287.      arglist_dcl
  1288. {
  1289.   if (flag_pedantic_errors)
  1290.     error_with_file_and_line (file, line, s, arglist);
  1291.   else
  1292.     warning_with_file_and_line (file, line, s, arglist);
  1293. }
  1294.  
  1295. /* Apologize for not implementing some feature.
  1296.    S and ARGLIST are a string and args for `printf'.  */
  1297.  
  1298. void
  1299. sorry (s, arglist)
  1300.      char *s;
  1301.      arglist_dcl
  1302. {
  1303.   sorrycount++;
  1304.   if (input_filename)
  1305.     fprintf (stderr, "%s:%d: ", input_filename, lineno);
  1306.   else
  1307.     fprintf (stderr, "%s: ", progname);
  1308.  
  1309.   fprintf (stderr, "sorry, not implemented: ");
  1310.   fprintf (stderr, s, arglist);
  1311.   fprintf (stderr, "\n");
  1312. }
  1313.  
  1314. /* Apologize for not implementing some feature, then quit.
  1315.    S and ARGLIST are a string and args for `printf'.  */
  1316.  
  1317. void
  1318. really_sorry (s, arglist)
  1319.      char *s;
  1320.      arglist_dcl
  1321. {
  1322.   if (input_filename)
  1323.     fprintf (stderr, "%s:%d: ", input_filename, lineno);
  1324.   else
  1325.     fprintf (stderr, "%s: ", progname);
  1326.  
  1327.   fprintf (stderr, "sorry, not implemented: ");
  1328.   fprintf (stderr, s, arglist);
  1329.   fatal (" (fatal)\n");
  1330. }
  1331.  
  1332. /* More 'friendly' abort that prints the line and file.
  1333.    config.h can #define abort fancy_abort if you like that sort of thing.
  1334.  
  1335.    I don't think this is actually a good idea.
  1336.    Other sorts of crashes will look a certain way.
  1337.    It is a good thing if crashes from calling abort look the same way.
  1338.      -- RMS  */
  1339.  
  1340. void
  1341. fancy_abort ()
  1342. {
  1343.   fatal ("internal gcc abort");
  1344. }
  1345.  
  1346. /* This calls abort and is used to avoid problems when abort if a macro.
  1347.    It is used when we need to pass the address of abort.  */
  1348.  
  1349. void
  1350. do_abort ()
  1351. {
  1352.   abort ();
  1353. }
  1354.  
  1355. /* When `malloc.c' is compiled with `rcheck' defined,
  1356.    it calls this function to report clobberage.  */
  1357.  
  1358. void
  1359. botch (s)
  1360. {
  1361.   abort ();
  1362. }
  1363.  
  1364. /* Same as `malloc' but report error if no memory available.  */
  1365.  
  1366. char *
  1367. xmalloc (size)
  1368.      unsigned size;
  1369. {
  1370.   register char *value = (char *) malloc (size);
  1371.   if (value == 0)
  1372.     fatal ("virtual memory exhausted");
  1373.   return value;
  1374. }
  1375.  
  1376. /* Same as `realloc' but report error if no memory available.  */
  1377.  
  1378. char *
  1379. xrealloc (ptr, size)
  1380.      char *ptr;
  1381.      int size;
  1382. {
  1383.   char *result = (char *) realloc (ptr, size);
  1384.   if (!result)
  1385.     fatal ("virtual memory exhausted");
  1386.   return result;
  1387. }
  1388.  
  1389. /* Return the logarithm of X, base 2, considering X unsigned,
  1390.    if X is a power of 2.  Otherwise, returns -1.
  1391.  
  1392.    This should be used via the `exact_log2' macro.  */
  1393.  
  1394. int
  1395. exact_log2_wide (x)
  1396.      register unsigned HOST_WIDE_INT x;
  1397. {
  1398.   register int log = 0;
  1399.   /* Test for 0 or a power of 2.  */
  1400.   if (x == 0 || x != (x & -x))
  1401.     return -1;
  1402.   while ((x >>= 1) != 0)
  1403.     log++;
  1404.   return log;
  1405. }
  1406.  
  1407. /* Given X, an unsigned number, return the largest int Y such that 2**Y <= X.
  1408.    If X is 0, return -1.
  1409.  
  1410.    This should be used via the floor_log2 macro.  */
  1411.  
  1412. int
  1413. floor_log2_wide (x)
  1414.      register unsigned HOST_WIDE_INT x;
  1415. {
  1416.   register int log = -1;
  1417.   while (x != 0)
  1418.     log++,
  1419.     x >>= 1;
  1420.   return log;
  1421. }
  1422.  
  1423. int float_handled;
  1424. jmp_buf float_handler;
  1425.  
  1426. /* Specify where to longjmp to when a floating arithmetic error happens.
  1427.    If HANDLER is 0, it means don't handle the errors any more.  */
  1428.  
  1429. void
  1430. set_float_handler (handler)
  1431.      jmp_buf handler;
  1432. {
  1433.   float_handled = (handler != 0);
  1434.   if (handler)
  1435.     bcopy (handler, float_handler, sizeof (float_handler));
  1436. }
  1437.  
  1438. /* Specify, in HANDLER, where to longjmp to when a floating arithmetic
  1439.    error happens, pushing the previous specification into OLD_HANDLER.
  1440.    Return an indication of whether there was a previous handler in effect.  */
  1441.  
  1442. int
  1443. push_float_handler (handler, old_handler)
  1444.      jmp_buf handler, old_handler;
  1445. {
  1446.   int was_handled = float_handled;
  1447.  
  1448.   float_handled = 1;
  1449.   if (was_handled)
  1450.     bcopy (float_handler, old_handler, sizeof (float_handler));
  1451.   bcopy (handler, float_handler, sizeof (float_handler));
  1452.   return was_handled;
  1453. }
  1454.  
  1455. /* Restore the previous specification of whether and where to longjmp to
  1456.    when a floating arithmetic error happens.  */
  1457.  
  1458. void
  1459. pop_float_handler (handled, handler)
  1460.      int handled;
  1461.      jmp_buf handler;
  1462. {
  1463.   float_handled = handled;
  1464.   if (handled)
  1465.     bcopy (handler, float_handler, sizeof (float_handler));
  1466. }
  1467.  
  1468. /* Signals actually come here.  */
  1469.  
  1470. static void
  1471. float_signal (signo)
  1472.      /* If this is missing, some compilers complain.  */
  1473.      int signo;
  1474. {
  1475.   if (float_handled == 0)
  1476.     abort ();
  1477. #if defined (USG) || defined (hpux)
  1478.   signal (SIGFPE, float_signal);  /* re-enable the signal catcher */
  1479. #endif
  1480.   float_handled = 0;
  1481.   signal (SIGFPE, float_signal);
  1482.   longjmp (float_handler, 1);
  1483. }
  1484.  
  1485. #ifndef atarist
  1486. /* Handler for SIGPIPE.  */
  1487.  
  1488. static void
  1489. pipe_closed (signo)
  1490.      /* If this is missing, some compilers complain.  */
  1491.      int signo;
  1492. {
  1493.   fatal ("output pipe has been closed");
  1494. }
  1495. #endif
  1496.  
  1497. /* Strip off a legitimate source ending from the input string NAME of
  1498.    length LEN. */
  1499.  
  1500. void
  1501. strip_off_ending (name, len)
  1502.      char *name;
  1503.      int len;
  1504. {
  1505.   if (len > 2 && ! strcmp (".c", name + len - 2))
  1506.     name[len - 2] = 0;
  1507.   else if (len > 2 && ! strcmp (".m", name + len - 2))
  1508.     name[len - 2] = 0;
  1509.   else if (len > 2 && ! strcmp (".i", name + len - 2))
  1510.     name[len - 2] = 0;
  1511.   else if (len > 3 && ! strcmp (".ii", name + len - 3))
  1512.     name[len - 3] = 0;
  1513.   else if (len > 3 && ! strcmp (".co", name + len - 3))
  1514.     name[len - 3] = 0;
  1515.   else if (len > 3 && ! strcmp (".cc", name + len - 3))
  1516.     name[len - 3] = 0;
  1517.   else if (len > 2 && ! strcmp (".C", name + len - 2))
  1518.     name[len - 2] = 0;
  1519.   else if (len > 4 && ! strcmp (".cxx", name + len - 4))
  1520.     name[len - 4] = 0;
  1521.   else if (len > 2 && ! strcmp (".f", name + len - 2))
  1522.     name[len - 2] = 0;
  1523.   /* Ada will use extensions like .ada, .adb, and .ads, so just test
  1524.      for "ad".  */
  1525.   else if (len > 4 && ! strncmp (".ad", name + len - 4, 3))
  1526.     name[len - 4] = 0;
  1527.   else if (len > 4 && ! strcmp (".atr", name + len - 4))
  1528.     name[len - 4] = 0;
  1529. }
  1530.  
  1531. /* Output a quoted string.  */
  1532. void
  1533. output_quoted_string (asm_file, string)
  1534.      FILE *asm_file;
  1535.      char *string;
  1536. {
  1537.   char c;
  1538.  
  1539.   putc ('\"', asm_file);
  1540.   while ((c = *string++) != 0)
  1541.     {
  1542.       if (c == '\"' || c == '\\')
  1543.     putc ('\\', asm_file);
  1544.       putc (c, asm_file);
  1545.     }
  1546.   putc ('\"', asm_file);
  1547. }
  1548.  
  1549. #ifdef SYSV
  1550. /* Output a file name in the form wanted by System V.  */
  1551.  
  1552. void
  1553. output_file_directive (asm_file, input_name)
  1554.      FILE *asm_file;
  1555.      char *input_name;
  1556. {
  1557.   int len = strlen (input_name);
  1558.   char *na = input_name + len;
  1559.  
  1560.   /* NA gets INPUT_NAME sans directory names.  */
  1561.   while (na > input_name)
  1562.     {
  1563.       if (na[-1] == '/')
  1564.     break;
  1565.       na--;
  1566.     }
  1567.  
  1568. #ifdef ASM_OUTPUT_MAIN_SOURCE_FILENAME
  1569.   ASM_OUTPUT_MAIN_SOURCE_FILENAME (asm_file, na);
  1570. #else
  1571. #ifdef ASM_OUTPUT_SOURCE_FILENAME
  1572.   ASM_OUTPUT_SOURCE_FILENAME (asm_file, na);
  1573. #else
  1574.   fprintf (asm_file, "\t.file\t");
  1575.   output_quoted_string (asm_file, na);
  1576.   fputc ('\n', asm_file);
  1577. #endif
  1578. #endif
  1579. }
  1580. #endif
  1581.  
  1582. /* Routine to build language identifier for object file. */
  1583. static void
  1584. output_lang_identify (asm_out_file)
  1585.      FILE *asm_out_file;
  1586. {
  1587.   int len = strlen (lang_identify ()) + sizeof ("__gnu_compiled_") + 1;
  1588.   char *s = (char *) alloca (len);
  1589.   sprintf (s, "__gnu_compiled_%s", lang_identify ());
  1590.   ASM_OUTPUT_LABEL (asm_out_file, s);
  1591. }
  1592.  
  1593. /* Compile an entire file of output from cpp, named NAME.
  1594.    Write a file of assembly output and various debugging dumps.  */
  1595.  
  1596. static void
  1597. compile_file (name)
  1598.      char *name;
  1599. {
  1600.   tree globals;
  1601.   int start_time;
  1602.   int dump_base_name_length;
  1603.  
  1604.   int name_specified = name != 0;
  1605.  
  1606.   if (dump_base_name == 0)
  1607.     dump_base_name = name ? name : "gccdump";
  1608.   dump_base_name_length = strlen (dump_base_name);
  1609.  
  1610.   parse_time = 0;
  1611.   varconst_time = 0;
  1612.   integration_time = 0;
  1613.   jump_time = 0;
  1614.   cse_time = 0;
  1615.   loop_time = 0;
  1616.   cse2_time = 0;
  1617.   flow_time = 0;
  1618.   combine_time = 0;
  1619.   sched_time = 0;
  1620.   local_alloc_time = 0;
  1621.   global_alloc_time = 0;
  1622.   sched2_time = 0;
  1623.   dbr_sched_time = 0;
  1624.   shorten_branch_time = 0;
  1625.   stack_reg_time = 0;
  1626.   final_time = 0;
  1627.   symout_time = 0;
  1628.   dump_time = 0;
  1629.  
  1630.   /* Open input file.  */
  1631.  
  1632.   if (name == 0 || !strcmp (name, "-"))
  1633.     {
  1634.       finput = stdin;
  1635.       name = "stdin";
  1636.     }
  1637.   else
  1638.     finput = fopen (name, "r");
  1639.   if (finput == 0)
  1640.     pfatal_with_name (name);
  1641.  
  1642. #ifdef IO_BUFFER_SIZE
  1643.   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
  1644. #endif
  1645.  
  1646.   /* Initialize data in various passes.  */
  1647.  
  1648.   init_obstacks ();
  1649.   init_tree_codes ();
  1650.   init_lex ();
  1651.   /* Some of these really don't need to be called when generating bytecode,
  1652.      but the options would have to be parsed first to know that. -bson */
  1653.   init_rtl ();
  1654.   init_emit_once (debug_info_level == DINFO_LEVEL_NORMAL
  1655.           || debug_info_level == DINFO_LEVEL_VERBOSE);
  1656.   init_decl_processing ();
  1657.   init_optabs ();
  1658.   init_stmt ();
  1659.   init_expmed ();
  1660.   init_expr_once ();
  1661.   init_loop ();
  1662.   init_reload ();
  1663.  
  1664.   if (flag_caller_saves)
  1665.     init_caller_save ();
  1666.  
  1667.   /* If auxiliary info generation is desired, open the output file.
  1668.      This goes in the same directory as the source file--unlike
  1669.      all the other output files.  */
  1670.   if (flag_gen_aux_info)
  1671.     {
  1672.       aux_info_file = fopen (aux_info_file_name, "w");
  1673.       if (aux_info_file == 0)
  1674.     pfatal_with_name (aux_info_file_name);
  1675.     }
  1676.  
  1677.   /* If rtl dump desired, open the output file.  */
  1678.   if (rtl_dump)
  1679.     {
  1680.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1681.       strcpy (dumpname, dump_base_name);
  1682.       strcat (dumpname, ".rtl");
  1683.       rtl_dump_file = fopen (dumpname, "w");
  1684.       if (rtl_dump_file == 0)
  1685.     pfatal_with_name (dumpname);
  1686.     }
  1687.  
  1688.   /* If jump_opt dump desired, open the output file.  */
  1689.   if (jump_opt_dump)
  1690.     {
  1691.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1692.       strcpy (dumpname, dump_base_name);
  1693. #ifndef atarist
  1694.       strcat (dumpname, ".jump");
  1695. #else
  1696.       strcat (dumpname, ".jmp");
  1697. #endif
  1698.       jump_opt_dump_file = fopen (dumpname, "w");
  1699.       if (jump_opt_dump_file == 0)
  1700.     pfatal_with_name (dumpname);
  1701.     }
  1702.  
  1703.   /* If cse dump desired, open the output file.  */
  1704.   if (cse_dump)
  1705.     {
  1706.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1707.       strcpy (dumpname, dump_base_name);
  1708.       strcat (dumpname, ".cse");
  1709.       cse_dump_file = fopen (dumpname, "w");
  1710.       if (cse_dump_file == 0)
  1711.     pfatal_with_name (dumpname);
  1712.     }
  1713.  
  1714.   /* If loop dump desired, open the output file.  */
  1715.   if (loop_dump)
  1716.     {
  1717.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1718.       strcpy (dumpname, dump_base_name);
  1719. #ifndef atarist
  1720.       strcat (dumpname, ".loop");
  1721. #else
  1722.       strcat (dumpname, ".lop");
  1723. #endif
  1724.       loop_dump_file = fopen (dumpname, "w");
  1725.       if (loop_dump_file == 0)
  1726.     pfatal_with_name (dumpname);
  1727.     }
  1728.  
  1729.   /* If cse2 dump desired, open the output file.  */
  1730.   if (cse2_dump)
  1731.     {
  1732.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1733.       strcpy (dumpname, dump_base_name);
  1734. #ifndef atarist
  1735.       strcat (dumpname, ".cse2");
  1736. #else
  1737.       strcat (dumpname, ".cs2");
  1738. #endif
  1739.       cse2_dump_file = fopen (dumpname, "w");
  1740.       if (cse2_dump_file == 0)
  1741.     pfatal_with_name (dumpname);
  1742.     }
  1743.  
  1744.   /* If flow dump desired, open the output file.  */
  1745.   if (flow_dump)
  1746.     {
  1747.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1748.       strcpy (dumpname, dump_base_name);
  1749. #ifndef atarist
  1750.       strcat (dumpname, ".flow");
  1751. #else
  1752.       strcat (dumpname, ".flo");
  1753. #endif
  1754.       flow_dump_file = fopen (dumpname, "w");
  1755.       if (flow_dump_file == 0)
  1756.     pfatal_with_name (dumpname);
  1757.     }
  1758.  
  1759.   /* If combine dump desired, open the output file.  */
  1760.   if (combine_dump)
  1761.     {
  1762.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
  1763.       strcpy (dumpname, dump_base_name);
  1764. #ifndef atarist
  1765.       strcat (dumpname, ".combine");
  1766. #else
  1767.       strcat (dumpname, ".cmb");
  1768. #endif
  1769.       combine_dump_file = fopen (dumpname, "w");
  1770.       if (combine_dump_file == 0)
  1771.     pfatal_with_name (dumpname);
  1772.     }
  1773.  
  1774.   /* If scheduling dump desired, open the output file.  */
  1775.   if (sched_dump)
  1776.     {
  1777.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1778.       strcpy (dumpname, dump_base_name);
  1779. #ifndef atarist
  1780.       strcat (dumpname, ".sched");
  1781. #else
  1782.       strcat (dumpname, ".sch");
  1783. #endif
  1784.       sched_dump_file = fopen (dumpname, "w");
  1785.       if (sched_dump_file == 0)
  1786.     pfatal_with_name (dumpname);
  1787.     }
  1788.  
  1789.   /* If local_reg dump desired, open the output file.  */
  1790.   if (local_reg_dump)
  1791.     {
  1792.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1793.       strcpy (dumpname, dump_base_name);
  1794. #ifndef atarist
  1795.       strcat (dumpname, ".lreg");
  1796. #else
  1797.       strcat (dumpname, ".lrg");
  1798. #endif
  1799.       local_reg_dump_file = fopen (dumpname, "w");
  1800.       if (local_reg_dump_file == 0)
  1801.     pfatal_with_name (dumpname);
  1802.     }
  1803.  
  1804.   /* If global_reg dump desired, open the output file.  */
  1805.   if (global_reg_dump)
  1806.     {
  1807.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1808.       strcpy (dumpname, dump_base_name);
  1809. #ifndef atarist
  1810.       strcat (dumpname, ".greg");
  1811. #else
  1812.       strcat (dumpname, ".grg");
  1813. #endif
  1814.       global_reg_dump_file = fopen (dumpname, "w");
  1815.       if (global_reg_dump_file == 0)
  1816.     pfatal_with_name (dumpname);
  1817.     }
  1818.  
  1819.   /* If 2nd scheduling dump desired, open the output file.  */
  1820.   if (sched2_dump)
  1821.     {
  1822.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 8);
  1823.       strcpy (dumpname, dump_base_name);
  1824. #ifndef atarist
  1825.       strcat (dumpname, ".sched2");
  1826. #else
  1827.       strcat (dumpname, ".sc2");
  1828. #endif
  1829.       sched2_dump_file = fopen (dumpname, "w");
  1830.       if (sched2_dump_file == 0)
  1831.     pfatal_with_name (dumpname);
  1832.     }
  1833.  
  1834.   /* If jump2_opt dump desired, open the output file.  */
  1835.   if (jump2_opt_dump)
  1836.     {
  1837.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1838.       strcpy (dumpname, dump_base_name);
  1839. #ifndef atarist
  1840.       strcat (dumpname, ".jump2");
  1841. #else
  1842.       strcat (dumpname, ".jp2");
  1843. #endif
  1844.       jump2_opt_dump_file = fopen (dumpname, "w");
  1845.       if (jump2_opt_dump_file == 0)
  1846.     pfatal_with_name (dumpname);
  1847.     }
  1848.  
  1849.   /* If dbr_sched dump desired, open the output file.  */
  1850.   if (dbr_sched_dump)
  1851.     {
  1852.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 7);
  1853.       strcpy (dumpname, dump_base_name);
  1854.       strcat (dumpname, ".dbr");
  1855.       dbr_sched_dump_file = fopen (dumpname, "w");
  1856.       if (dbr_sched_dump_file == 0)
  1857.     pfatal_with_name (dumpname);
  1858.     }
  1859.  
  1860. #ifdef STACK_REGS
  1861.  
  1862.   /* If stack_reg dump desired, open the output file.  */
  1863.   if (stack_reg_dump)
  1864.     {
  1865.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 10);
  1866.       strcpy (dumpname, dump_base_name);
  1867. #ifndef atarist
  1868.       strcat (dumpname, ".stack");
  1869. #else
  1870.       strcat (dumpname, ".stk");
  1871. #endif
  1872.       stack_reg_dump_file = fopen (dumpname, "w");
  1873.       if (stack_reg_dump_file == 0)
  1874.     pfatal_with_name (dumpname);
  1875.     }
  1876.  
  1877. #endif
  1878.  
  1879.   /* Open assembler code output file.  */
  1880.  
  1881.   if (! name_specified && asm_file_name == 0)
  1882.     asm_out_file = stdout;
  1883.   else
  1884.     {
  1885.       register char *dumpname = (char *) xmalloc (dump_base_name_length + 6);
  1886.       int len = strlen (dump_base_name);
  1887.       strcpy (dumpname, dump_base_name);
  1888.       strip_off_ending (dumpname, len);
  1889.       strcat (dumpname, ".s");
  1890.       if (asm_file_name == 0)
  1891.     {
  1892.       asm_file_name = (char *) xmalloc (strlen (dumpname) + 1);
  1893.       strcpy (asm_file_name, dumpname);
  1894.     }
  1895.       if (!strcmp (asm_file_name, "-"))
  1896.     asm_out_file = stdout;
  1897.       else
  1898.     asm_out_file = fopen (asm_file_name, "w");
  1899.       if (asm_out_file == 0)
  1900.     pfatal_with_name (asm_file_name);
  1901.     }
  1902.  
  1903. #ifdef IO_BUFFER_SIZE
  1904.   setvbuf (asm_out_file, (char *) xmalloc (IO_BUFFER_SIZE),
  1905.        _IOFBF, IO_BUFFER_SIZE);
  1906. #endif
  1907.  
  1908.   input_filename = name;
  1909.  
  1910.   /* Perform language-specific initialization.
  1911.      This may set main_input_filename.  */
  1912.   lang_init ();
  1913.  
  1914.   /* If the input doesn't start with a #line, use the input name
  1915.      as the official input file name.  */
  1916.   if (main_input_filename == 0)
  1917.     main_input_filename = name;
  1918.  
  1919.   /* Put an entry on the input file stack for the main input file.  */
  1920.   input_file_stack
  1921.     = (struct file_stack *) xmalloc (sizeof (struct file_stack));
  1922.   input_file_stack->next = 0;
  1923.   input_file_stack->name = input_filename;
  1924.  
  1925.   if (!output_bytecode)
  1926.     {
  1927.       ASM_FILE_START (asm_out_file);
  1928.     }
  1929.  
  1930.   /* Output something to inform GDB that this compilation was by GCC.  Also
  1931.      serves to tell GDB file consists of bytecodes. */
  1932.   if (output_bytecode)
  1933.     fprintf (asm_out_file, "bc_gcc2_compiled.:\n");
  1934.   else
  1935.     {
  1936. #ifndef ASM_IDENTIFY_GCC
  1937.       fprintf (asm_out_file, "gcc2_compiled.:\n");
  1938. #else
  1939.       ASM_IDENTIFY_GCC (asm_out_file);
  1940. #endif
  1941.     }
  1942.  
  1943.   /* Output something to identify which front-end produced this file. */
  1944. #ifdef ASM_IDENTIFY_LANGUAGE
  1945.   ASM_IDENTIFY_LANGUAGE (asm_out_file);
  1946. #endif
  1947.  
  1948.   if (output_bytecode)
  1949.     {
  1950.       if (profile_flag || profile_block_flag)
  1951.     error ("profiling not supported in bytecode compilation");
  1952.     }
  1953.   else
  1954.     {
  1955.       /* ??? Note: There used to be a conditional here
  1956.      to call assemble_zeros without fail if DBX_DEBUGGING_INFO is defined.
  1957.      This was to guarantee separation between gcc_compiled. and
  1958.      the first function, for the sake of dbx on Suns.
  1959.      However, having the extra zero here confused the Emacs
  1960.      code for unexec, and might confuse other programs too.
  1961.      Therefore, I took out that change.
  1962.      In future versions we should find another way to solve
  1963.      that dbx problem.  -- rms, 23 May 93.  */
  1964.       
  1965.       /* Don't let the first function fall at the same address
  1966.      as gcc_compiled., if profiling.  */
  1967.       if (profile_flag || profile_block_flag)
  1968.     assemble_zeros (UNITS_PER_WORD);
  1969.     }
  1970.  
  1971.   /* If dbx symbol table desired, initialize writing it
  1972.      and output the predefined types.  */
  1973. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  1974.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  1975.     TIMEVAR (symout_time, dbxout_init (asm_out_file, main_input_filename,
  1976.                        getdecls ()));
  1977. #endif
  1978. #ifdef SDB_DEBUGGING_INFO
  1979.   if (write_symbols == SDB_DEBUG)
  1980.     TIMEVAR (symout_time, sdbout_init (asm_out_file, main_input_filename,
  1981.                        getdecls ()));
  1982. #endif
  1983. #ifdef DWARF_DEBUGGING_INFO
  1984.   if (write_symbols == DWARF_DEBUG)
  1985.     TIMEVAR (symout_time, dwarfout_init (asm_out_file, main_input_filename));
  1986. #endif
  1987.  
  1988.   /* Initialize yet another pass.  */
  1989.  
  1990.   if (!output_bytecode)
  1991.     init_final (main_input_filename);
  1992.  
  1993.   start_time = get_run_time ();
  1994.  
  1995.   /* Call the parser, which parses the entire file
  1996.      (calling rest_of_compilation for each function).  */
  1997.  
  1998.   if (yyparse () != 0)
  1999.     if (errorcount == 0)
  2000.       fprintf (stderr, "Errors detected in input file (your bison.simple is out of date)");
  2001.  
  2002.   /* Compilation is now finished except for writing
  2003.      what's left of the symbol table output.  */
  2004.  
  2005.   parse_time += get_run_time () - start_time;
  2006.  
  2007.   parse_time -= integration_time;
  2008.   parse_time -= varconst_time;
  2009.  
  2010.   globals = getdecls ();
  2011.  
  2012.   /* Really define vars that have had only a tentative definition.
  2013.      Really output inline functions that must actually be callable
  2014.      and have not been output so far.  */
  2015.  
  2016.   {
  2017.     int len = list_length (globals);
  2018.     tree *vec = (tree *) alloca (sizeof (tree) * len);
  2019.     int i;
  2020.     tree decl;
  2021.  
  2022.     /* Process the decls in reverse order--earliest first.
  2023.        Put them into VEC from back to front, then take out from front.  */
  2024.  
  2025.     for (i = 0, decl = globals; i < len; i++, decl = TREE_CHAIN (decl))
  2026.       vec[len - i - 1] = decl;
  2027.  
  2028.     for (i = 0; i < len; i++)
  2029.       {
  2030.     decl = vec[i];
  2031.     if (TREE_CODE (decl) == VAR_DECL && DECL_SIZE (decl) == 0
  2032.         && incomplete_decl_finalize_hook != 0)
  2033.       (*incomplete_decl_finalize_hook) (decl);
  2034.  
  2035.     if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl)
  2036.         && ! TREE_ASM_WRITTEN (decl))
  2037.       {
  2038.         /* Don't write out static consts, unless we used them.
  2039.            (This used to write them out only if the address was
  2040.            taken, but that was wrong; if the variable was simply
  2041.            referred to, it still needs to exist or else it will
  2042.            be undefined in the linker.)  */
  2043.         if (! TREE_READONLY (decl)
  2044.         || TREE_PUBLIC (decl)
  2045.         || TREE_USED (decl)
  2046.         || TREE_ADDRESSABLE (decl)
  2047.         || TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
  2048.           rest_of_decl_compilation (decl, NULL_PTR, 1, 1);
  2049.         else
  2050.           /* Cancel the RTL for this decl so that, if debugging info
  2051.          output for global variables is still to come,
  2052.          this one will be omitted.  */
  2053.           DECL_RTL (decl) = NULL;
  2054.       }
  2055.  
  2056.     if (TREE_CODE (decl) == FUNCTION_DECL
  2057.         && ! TREE_ASM_WRITTEN (decl)
  2058.         && DECL_INITIAL (decl) != 0
  2059.         && (TREE_ADDRESSABLE (decl)
  2060.         || TREE_ADDRESSABLE (DECL_ASSEMBLER_NAME (decl)))
  2061.         && ! DECL_EXTERNAL (decl))
  2062.       {
  2063.         temporary_allocation ();
  2064.         output_inline_function (decl);
  2065.         permanent_allocation ();
  2066.       }
  2067.  
  2068.     /* Warn about any function
  2069.        declared static but not defined.
  2070.        We don't warn about variables,
  2071.        because many programs have static variables
  2072.        that exist only to get some text into the object file.  */
  2073.     if ((warn_unused
  2074.          || TREE_USED (decl)
  2075.          || (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl))))
  2076.         && TREE_CODE (decl) == FUNCTION_DECL
  2077.         && DECL_INITIAL (decl) == 0
  2078.         && DECL_EXTERNAL (decl)
  2079.         && ! TREE_PUBLIC (decl))
  2080.       {
  2081.         /* This should be a pedwarn, except that there is
  2082.            no easy way to prevent it from happening when the
  2083.            name is used only inside a sizeof.
  2084.            This at least avoids being incorrect.  */
  2085.         warning_with_decl (decl, 
  2086.                    "`%s' declared `static' but never defined");
  2087.         /* This symbol is effectively an "extern" declaration now.  */
  2088.         TREE_PUBLIC (decl) = 1;
  2089.         assemble_external (decl);
  2090.  
  2091.       }
  2092.     /* Warn about static fns or vars defined but not used,
  2093.        but not about inline functions
  2094.        since unused inline statics is normal practice.  */
  2095.     if (warn_unused
  2096.         && (TREE_CODE (decl) == FUNCTION_DECL
  2097.         || TREE_CODE (decl) == VAR_DECL)
  2098.         && ! DECL_IN_SYSTEM_HEADER (decl)
  2099.         && ! DECL_EXTERNAL (decl)
  2100.         && ! TREE_PUBLIC (decl)
  2101.         && ! TREE_USED (decl)
  2102.         && ! DECL_INLINE (decl)
  2103.         && ! DECL_REGISTER (decl)
  2104.         /* The TREE_USED bit for file-scope decls
  2105.            is kept in the identifier, to handle multiple
  2106.            external decls in different scopes.  */
  2107.         && ! TREE_USED (DECL_NAME (decl)))
  2108.       warning_with_decl (decl, "`%s' defined but not used");
  2109.  
  2110. #ifdef SDB_DEBUGGING_INFO
  2111.     /* The COFF linker can move initialized global vars to the end.
  2112.        And that can screw up the symbol ordering.
  2113.        By putting the symbols in that order to begin with,
  2114.        we avoid a problem.  mcsun!unido!fauern!tumuc!pes@uunet.uu.net.  */
  2115.     if (write_symbols == SDB_DEBUG && TREE_CODE (decl) == VAR_DECL
  2116.         && TREE_PUBLIC (decl) && DECL_INITIAL (decl)
  2117.         && DECL_RTL (decl) != 0)
  2118.       TIMEVAR (symout_time, sdbout_symbol (decl, 0));
  2119.  
  2120.     /* Output COFF information for non-global
  2121.        file-scope initialized variables. */
  2122.     if (write_symbols == SDB_DEBUG
  2123.         && TREE_CODE (decl) == VAR_DECL
  2124.         && DECL_INITIAL (decl)
  2125.         && DECL_RTL (decl) != 0
  2126.         && GET_CODE (DECL_RTL (decl)) == MEM)
  2127.       TIMEVAR (symout_time, sdbout_toplevel_data (decl));
  2128. #endif /* SDB_DEBUGGING_INFO */
  2129. #ifdef DWARF_DEBUGGING_INFO
  2130.     /* Output DWARF information for file-scope tentative data object
  2131.        declarations, file-scope (extern) function declarations (which
  2132.        had no corresponding body) and file-scope tagged type declarations
  2133.        and definitions which have not yet been forced out.  */
  2134.  
  2135.     if (write_symbols == DWARF_DEBUG
  2136.         && (TREE_CODE (decl) != FUNCTION_DECL || !DECL_INITIAL (decl)))
  2137.       TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 1));
  2138. #endif
  2139.       }
  2140.   }
  2141.  
  2142.   /* Do dbx symbols */
  2143. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2144.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2145.     TIMEVAR (symout_time,
  2146.          {
  2147.            dbxout_finish (asm_out_file, main_input_filename);
  2148.          });
  2149. #endif
  2150.  
  2151. #ifdef DWARF_DEBUGGING_INFO
  2152.   if (write_symbols == DWARF_DEBUG)
  2153.     TIMEVAR (symout_time,
  2154.          {
  2155.            dwarfout_finish ();
  2156.          });
  2157. #endif
  2158.  
  2159.   /* Output some stuff at end of file if nec.  */
  2160.  
  2161.   if (!output_bytecode)
  2162.     {
  2163.       end_final (main_input_filename);
  2164.  
  2165. #ifdef ASM_FILE_END
  2166.       ASM_FILE_END (asm_out_file);
  2167. #endif
  2168.     }
  2169.  
  2170.  after_finish_compilation:
  2171.  
  2172.   /* Language-specific end of compilation actions.  */
  2173.  
  2174.   lang_finish ();
  2175.  
  2176.   /* Close the dump files.  */
  2177.  
  2178.   if (flag_gen_aux_info)
  2179.     {
  2180.       fclose (aux_info_file);
  2181.       if (errorcount)
  2182.     unlink (aux_info_file_name);
  2183.     }
  2184.  
  2185.   if (rtl_dump)
  2186.     fclose (rtl_dump_file);
  2187.  
  2188.   if (jump_opt_dump)
  2189.     fclose (jump_opt_dump_file);
  2190.  
  2191.   if (cse_dump)
  2192.     fclose (cse_dump_file);
  2193.  
  2194.   if (loop_dump)
  2195.     fclose (loop_dump_file);
  2196.  
  2197.   if (cse2_dump)
  2198.     fclose (cse2_dump_file);
  2199.  
  2200.   if (flow_dump)
  2201.     fclose (flow_dump_file);
  2202.  
  2203.   if (combine_dump)
  2204.     {
  2205.       dump_combine_total_stats (combine_dump_file);
  2206.       fclose (combine_dump_file);
  2207.     }
  2208.  
  2209.   if (sched_dump)
  2210.     fclose (sched_dump_file);
  2211.  
  2212.   if (local_reg_dump)
  2213.     fclose (local_reg_dump_file);
  2214.  
  2215.   if (global_reg_dump)
  2216.     fclose (global_reg_dump_file);
  2217.  
  2218.   if (sched2_dump)
  2219.     fclose (sched2_dump_file);
  2220.  
  2221.   if (jump2_opt_dump)
  2222.     fclose (jump2_opt_dump_file);
  2223.  
  2224.   if (dbr_sched_dump)
  2225.     fclose (dbr_sched_dump_file);
  2226.  
  2227. #ifdef STACK_REGS
  2228.   if (stack_reg_dump)
  2229.     fclose (stack_reg_dump_file);
  2230. #endif
  2231.  
  2232.   /* Close non-debugging input and output files.  Take special care to note
  2233.      whether fclose returns an error, since the pages might still be on the
  2234.      buffer chain while the file is open.  */
  2235.  
  2236.   fclose (finput);
  2237.   if (ferror (asm_out_file) != 0 || fclose (asm_out_file) != 0)
  2238.     fatal_io_error (asm_file_name);
  2239.  
  2240.   /* Print the times.  */
  2241.  
  2242.   if (! quiet_flag)
  2243.     {
  2244.       fprintf (stderr,"\n");
  2245.       print_time ("parse", parse_time);
  2246.  
  2247.       if (!output_bytecode)
  2248.     {
  2249.       print_time ("integration", integration_time);
  2250.       print_time ("jump", jump_time);
  2251.       print_time ("cse", cse_time);
  2252.       print_time ("loop", loop_time);
  2253.       print_time ("cse2", cse2_time);
  2254.       print_time ("flow", flow_time);
  2255.       print_time ("combine", combine_time);
  2256.       print_time ("sched", sched_time);
  2257.       print_time ("local-alloc", local_alloc_time);
  2258.       print_time ("global-alloc", global_alloc_time);
  2259.       print_time ("sched2", sched2_time);
  2260.       print_time ("dbranch", dbr_sched_time);
  2261.       print_time ("shorten-branch", shorten_branch_time);
  2262.       print_time ("stack-reg", stack_reg_time);
  2263.       print_time ("final", final_time);
  2264.       print_time ("varconst", varconst_time);
  2265.       print_time ("symout", symout_time);
  2266.       print_time ("dump", dump_time);
  2267.     }
  2268.     }
  2269. }
  2270.  
  2271. /* This is called from various places for FUNCTION_DECL, VAR_DECL,
  2272.    and TYPE_DECL nodes.
  2273.  
  2274.    This does nothing for local (non-static) variables.
  2275.    Otherwise, it sets up the RTL and outputs any assembler code
  2276.    (label definition, storage allocation and initialization).
  2277.  
  2278.    DECL is the declaration.  If ASMSPEC is nonzero, it specifies
  2279.    the assembler symbol name to be used.  TOP_LEVEL is nonzero
  2280.    if this declaration is not within a function.  */
  2281.  
  2282. void
  2283. rest_of_decl_compilation (decl, asmspec, top_level, at_end)
  2284.      tree decl;
  2285.      char *asmspec;
  2286.      int top_level;
  2287.      int at_end;
  2288. {
  2289.   /* Declarations of variables, and of functions defined elsewhere.  */
  2290.  
  2291. /* The most obvious approach, to put an #ifndef around where
  2292.    this macro is used, doesn't work since it's inside a macro call.  */
  2293. #ifndef ASM_FINISH_DECLARE_OBJECT
  2294. #define ASM_FINISH_DECLARE_OBJECT(FILE, DECL, TOP, END)
  2295. #endif
  2296.  
  2297.   /* Forward declarations for nested functions are not "external",
  2298.      but we need to treat them as if they were.  */
  2299.   if (TREE_STATIC (decl) || DECL_EXTERNAL (decl)
  2300.       || TREE_CODE (decl) == FUNCTION_DECL)
  2301.     TIMEVAR (varconst_time,
  2302.          {
  2303.            make_decl_rtl (decl, asmspec, top_level);
  2304.            /* Initialized extern variable exists to be replaced
  2305.           with its value, or represents something that will be
  2306.           output in another file.  */
  2307.            if (! (TREE_CODE (decl) == VAR_DECL
  2308.               && DECL_EXTERNAL (decl) && TREE_READONLY (decl)
  2309.               && DECL_INITIAL (decl) != 0
  2310.               && DECL_INITIAL (decl) != error_mark_node))
  2311.          /* Don't output anything
  2312.             when a tentative file-scope definition is seen.
  2313.             But at end of compilation, do output code for them.  */
  2314.          if (! (! at_end && top_level
  2315.             && (DECL_INITIAL (decl) == 0
  2316.                 || DECL_INITIAL (decl) == error_mark_node)))
  2317.            assemble_variable (decl, top_level, at_end, 0);
  2318.            if (decl == last_assemble_variable_decl)
  2319.          {
  2320.            ASM_FINISH_DECLARE_OBJECT (asm_out_file, decl,
  2321.                           top_level, at_end);
  2322.          }
  2323.          });
  2324.   else if (DECL_REGISTER (decl) && asmspec != 0)
  2325.     {
  2326.       if (decode_reg_name (asmspec) >= 0)
  2327.     {
  2328.       DECL_RTL (decl) = 0;
  2329.       make_decl_rtl (decl, asmspec, top_level);
  2330.     }
  2331.       else
  2332.     error ("invalid register name `%s' for register variable", asmspec);
  2333.     }
  2334. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2335.   else if ((write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2336.        && TREE_CODE (decl) == TYPE_DECL)
  2337.     TIMEVAR (symout_time, dbxout_symbol (decl, 0));
  2338. #endif
  2339. #ifdef SDB_DEBUGGING_INFO
  2340.   else if (write_symbols == SDB_DEBUG && top_level
  2341.        && TREE_CODE (decl) == TYPE_DECL)
  2342.     TIMEVAR (symout_time, sdbout_symbol (decl, 0));
  2343. #endif
  2344. }
  2345.  
  2346. /* Called after finishing a record, union or enumeral type.  */
  2347.  
  2348. void
  2349. rest_of_type_compilation (type, toplev)
  2350.      tree type;
  2351.      int toplev;
  2352. {
  2353. #if defined (DBX_DEBUGGING_INFO) || defined (XCOFF_DEBUGGING_INFO)
  2354.   if (write_symbols == DBX_DEBUG || write_symbols == XCOFF_DEBUG)
  2355.     TIMEVAR (symout_time, dbxout_symbol (TYPE_STUB_DECL (type), !toplev));
  2356. #endif
  2357. #ifdef SDB_DEBUGGING_INFO
  2358.   if (write_symbols == SDB_DEBUG)
  2359.     TIMEVAR (symout_time, sdbout_symbol (TYPE_STUB_DECL (type), !toplev));
  2360. #endif
  2361. }
  2362.  
  2363. /* This is called from finish_function (within yyparse)
  2364.    after each top-level definition is parsed.
  2365.    It is supposed to compile that function or variable
  2366.    and output the assembler code for it.
  2367.    After we return, the tree storage is freed.  */
  2368.  
  2369. void
  2370. rest_of_compilation (decl)
  2371.      tree decl;
  2372. {
  2373.   register rtx insns;
  2374.   int start_time = get_run_time ();
  2375.   int tem;
  2376.   /* Nonzero if we have saved the original DECL_INITIAL of the function,
  2377.      to be restored after we finish compiling the function
  2378.      (for use when compiling inline calls to this function).  */
  2379.   tree saved_block_tree = 0;
  2380.   /* Likewise, for DECL_ARGUMENTS.  */
  2381.   tree saved_arguments = 0;
  2382.   int failure = 0;
  2383.  
  2384.   if (output_bytecode)
  2385.     return;
  2386.  
  2387.   /* If we are reconsidering an inline function
  2388.      at the end of compilation, skip the stuff for making it inline.  */
  2389.  
  2390.   if (DECL_SAVED_INSNS (decl) == 0)
  2391.     {
  2392.       int specd = DECL_INLINE (decl);
  2393.       char *lose;
  2394.  
  2395.       /* If requested, consider whether to make this function inline.  */
  2396.       if (specd || flag_inline_functions)
  2397.     TIMEVAR (integration_time,
  2398.          {
  2399.            lose = function_cannot_inline_p (decl);
  2400.            /* If not optimzing, then make sure the DECL_INLINE
  2401.               bit is off.  */
  2402.            if (lose || ! optimize)
  2403.              {
  2404.                if (warn_inline && specd)
  2405.              warning_with_decl (decl, lose);
  2406.                DECL_INLINE (decl) = 0;
  2407.                /* Don't really compile an extern inline function.
  2408.               If we can't make it inline, pretend
  2409.               it was only declared.  */
  2410.                if (DECL_EXTERNAL (decl))
  2411.              {
  2412.                DECL_INITIAL (decl) = 0;
  2413.                goto exit_rest_of_compilation;
  2414.              }
  2415.              }
  2416.            else
  2417.              DECL_INLINE (decl) = 1;
  2418.          });
  2419.  
  2420.       insns = get_insns ();
  2421.  
  2422.       /* Dump the rtl code if we are dumping rtl.  */
  2423.  
  2424.       if (rtl_dump)
  2425.     TIMEVAR (dump_time,
  2426.          {
  2427.            fprintf (rtl_dump_file, "\n;; Function %s\n\n",
  2428.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  2429.            if (DECL_SAVED_INSNS (decl))
  2430.              fprintf (rtl_dump_file, ";; (integrable)\n\n");
  2431.            print_rtl (rtl_dump_file, insns);
  2432.            fflush (rtl_dump_file);
  2433.          });
  2434.  
  2435.       /* If function is inline, and we don't yet know whether to
  2436.      compile it by itself, defer decision till end of compilation.
  2437.      finish_compilation will call rest_of_compilation again
  2438.      for those functions that need to be output.  */
  2439.  
  2440.       if (DECL_INLINE (decl)
  2441.       && ((! TREE_PUBLIC (decl) && ! TREE_ADDRESSABLE (decl)
  2442.            && ! flag_keep_inline_functions)
  2443.           || DECL_EXTERNAL (decl)))
  2444.     {
  2445. #ifdef DWARF_DEBUGGING_INFO
  2446.       /* Generate the DWARF info for the "abstract" instance
  2447.          of a function which we may later generate inlined and/or
  2448.          out-of-line instances of.  */
  2449.       if (write_symbols == DWARF_DEBUG)
  2450.         {
  2451.           set_decl_abstract_flags (decl, 1);
  2452.           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2453.           set_decl_abstract_flags (decl, 0);
  2454.         }
  2455. #endif
  2456.       TIMEVAR (integration_time, save_for_inline_nocopy (decl));
  2457.       goto exit_rest_of_compilation;
  2458.     }
  2459.  
  2460.       /* If we have to compile the function now, save its rtl and subdecls
  2461.      so that its compilation will not affect what others get.  */
  2462.       if (DECL_INLINE (decl))
  2463.     {
  2464. #ifdef DWARF_DEBUGGING_INFO
  2465.       /* Generate the DWARF info for the "abstract" instance of
  2466.          a function which we will generate an out-of-line instance
  2467.          of almost immediately (and which we may also later generate
  2468.          various inlined instances of).  */
  2469.       if (write_symbols == DWARF_DEBUG)
  2470.         {
  2471.           set_decl_abstract_flags (decl, 1);
  2472.           TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2473.           set_decl_abstract_flags (decl, 0);
  2474.         }
  2475. #endif
  2476.       saved_block_tree = DECL_INITIAL (decl);
  2477.       saved_arguments = DECL_ARGUMENTS (decl);
  2478.       TIMEVAR (integration_time, save_for_inline_copying (decl));
  2479.     }
  2480.     }
  2481.  
  2482.   TREE_ASM_WRITTEN (decl) = 1;
  2483.  
  2484.   /* Now that integrate will no longer see our rtl, we need not distinguish
  2485.      between the return value of this function and the return value of called
  2486.      functions.  */
  2487.   rtx_equal_function_value_matters = 0;
  2488.  
  2489.   /* Don't return yet if -Wreturn-type; we need to do jump_optimize.  */
  2490.   if ((rtl_dump_and_exit || flag_syntax_only) && !warn_return_type)
  2491.     {
  2492.       goto exit_rest_of_compilation;
  2493.     }
  2494.  
  2495.   /* From now on, allocate rtl in current_obstack, not in saveable_obstack.
  2496.      Note that that may have been done above, in save_for_inline_copying.
  2497.      The call to resume_temporary_allocation near the end of this function
  2498.      goes back to the usual state of affairs.  */
  2499.  
  2500.   rtl_in_current_obstack ();
  2501.  
  2502. #ifdef FINALIZE_PIC
  2503.   /* If we are doing position-independent code generation, now
  2504.      is the time to output special prologues and epilogues.
  2505.      We do not want to do this earlier, because it just clutters
  2506.      up inline functions with meaningless insns.  */
  2507.   if (flag_pic)
  2508.     FINALIZE_PIC;
  2509. #endif
  2510.  
  2511.   insns = get_insns ();
  2512.  
  2513.   /* Copy any shared structure that should not be shared.  */
  2514.  
  2515.   unshare_all_rtl (insns);
  2516.  
  2517.   /* Instantiate all virtual registers.  */
  2518.  
  2519.   instantiate_virtual_regs (current_function_decl, get_insns ());
  2520.  
  2521.   /* See if we have allocated stack slots that are not directly addressable.
  2522.      If so, scan all the insns and create explicit address computation
  2523.      for all references to such slots.  */
  2524. /*   fixup_stack_slots (); */
  2525.  
  2526.   /* Do jump optimization the first time, if -opt.
  2527.      Also do it if -W, but in that case it doesn't change the rtl code,
  2528.      it only computes whether control can drop off the end of the function.  */
  2529.  
  2530.   if (optimize > 0 || extra_warnings || warn_return_type
  2531.       /* If function is `volatile', we should warn if it tries to return.  */
  2532.       || TREE_THIS_VOLATILE (decl))
  2533.     {
  2534.       TIMEVAR (jump_time, reg_scan (insns, max_reg_num (), 0));
  2535.       TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 1));
  2536.     }
  2537.  
  2538.   /* Now is when we stop if -fsyntax-only and -Wreturn-type.  */
  2539.   if (rtl_dump_and_exit || flag_syntax_only)
  2540.     goto exit_rest_of_compilation;
  2541.  
  2542.   /* Dump rtl code after jump, if we are doing that.  */
  2543.  
  2544.   if (jump_opt_dump)
  2545.     TIMEVAR (dump_time,
  2546.          {
  2547.            fprintf (jump_opt_dump_file, "\n;; Function %s\n\n",
  2548.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2549.            print_rtl (jump_opt_dump_file, insns);
  2550.            fflush (jump_opt_dump_file);
  2551.          });
  2552.  
  2553.   /* Perform common subexpression elimination.
  2554.      Nonzero value from `cse_main' means that jumps were simplified
  2555.      and some code may now be unreachable, so do
  2556.      jump optimization again.  */
  2557.  
  2558.   if (cse_dump)
  2559.     TIMEVAR (dump_time,
  2560.          {
  2561.            fprintf (cse_dump_file, "\n;; Function %s\n\n",
  2562.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2563.          });
  2564.  
  2565.   if (optimize > 0)
  2566.     {
  2567.       TIMEVAR (cse_time, reg_scan (insns, max_reg_num (), 1));
  2568.  
  2569.       if (flag_thread_jumps)
  2570.     /* Hacks by tiemann & kenner.  */
  2571.     TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
  2572.  
  2573.       TIMEVAR (cse_time, tem = cse_main (insns, max_reg_num (),
  2574.                      0, cse_dump_file));
  2575.       TIMEVAR (cse_time, delete_dead_from_cse (insns, max_reg_num ()));
  2576.  
  2577.       if (tem)
  2578.     TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
  2579.     }
  2580.  
  2581.   /* Dump rtl code after cse, if we are doing that.  */
  2582.  
  2583.   if (cse_dump)
  2584.     TIMEVAR (dump_time,
  2585.          {
  2586.            print_rtl (cse_dump_file, insns);
  2587.            fflush (cse_dump_file);
  2588.          });
  2589.  
  2590.   if (loop_dump)
  2591.     TIMEVAR (dump_time,
  2592.          {
  2593.            fprintf (loop_dump_file, "\n;; Function %s\n\n",
  2594.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2595.          });
  2596.  
  2597.   /* Move constant computations out of loops.  */
  2598.  
  2599.   if (optimize > 0)
  2600.     {
  2601.       TIMEVAR (loop_time,
  2602.            {
  2603.          loop_optimize (insns, loop_dump_file);
  2604.            });
  2605.     }
  2606.  
  2607.   /* Dump rtl code after loop opt, if we are doing that.  */
  2608.  
  2609.   if (loop_dump)
  2610.     TIMEVAR (dump_time,
  2611.          {
  2612.            print_rtl (loop_dump_file, insns);
  2613.            fflush (loop_dump_file);
  2614.          });
  2615.  
  2616.   if (cse2_dump)
  2617.     TIMEVAR (dump_time,
  2618.          {
  2619.            fprintf (cse2_dump_file, "\n;; Function %s\n\n",
  2620.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2621.          });
  2622.  
  2623.   if (optimize > 0 && flag_rerun_cse_after_loop)
  2624.     {
  2625.       TIMEVAR (cse2_time, reg_scan (insns, max_reg_num (), 0));
  2626.  
  2627.       TIMEVAR (cse2_time, tem = cse_main (insns, max_reg_num (),
  2628.                       1, cse2_dump_file));
  2629.       if (tem)
  2630.     TIMEVAR (jump_time, jump_optimize (insns, 0, 0, 0));
  2631.     }
  2632.  
  2633.   if (optimize > 0 && flag_thread_jumps)
  2634.     /* This pass of jump threading straightens out code
  2635.        that was kinked by loop optimization.  */
  2636.     TIMEVAR (jump_time, thread_jumps (insns, max_reg_num (), 0));
  2637.  
  2638.   /* Dump rtl code after cse, if we are doing that.  */
  2639.  
  2640.   if (cse2_dump)
  2641.     TIMEVAR (dump_time,
  2642.          {
  2643.            print_rtl (cse2_dump_file, insns);
  2644.            fflush (cse2_dump_file);
  2645.          });
  2646.  
  2647.   /* We are no longer anticipating cse in this function, at least.  */
  2648.  
  2649.   cse_not_expected = 1;
  2650.  
  2651.   /* Now we choose between stupid (pcc-like) register allocation
  2652.      (if we got the -noreg switch and not -opt)
  2653.      and smart register allocation.  */
  2654.  
  2655.   if (optimize > 0)            /* Stupid allocation probably won't work */
  2656.     obey_regdecls = 0;        /* if optimizations being done.  */
  2657.  
  2658.   regclass_init ();
  2659.  
  2660.   /* Print function header into flow dump now
  2661.      because doing the flow analysis makes some of the dump.  */
  2662.  
  2663.   if (flow_dump)
  2664.     TIMEVAR (dump_time,
  2665.          {
  2666.            fprintf (flow_dump_file, "\n;; Function %s\n\n",
  2667.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2668.          });
  2669.  
  2670.   if (obey_regdecls)
  2671.     {
  2672.       TIMEVAR (flow_time,
  2673.            {
  2674.          regclass (insns, max_reg_num ());
  2675.          stupid_life_analysis (insns, max_reg_num (),
  2676.                        flow_dump_file);
  2677.            });
  2678.     }
  2679.   else
  2680.     {
  2681.       /* Do control and data flow analysis,
  2682.      and write some of the results to dump file.  */
  2683.  
  2684.       TIMEVAR (flow_time, flow_analysis (insns, max_reg_num (),
  2685.                      flow_dump_file));
  2686.       if (warn_uninitialized)
  2687.     {
  2688.       uninitialized_vars_warning (DECL_INITIAL (decl));
  2689.       setjmp_args_warning ();
  2690.     }
  2691.     }
  2692.  
  2693.   /* Dump rtl after flow analysis.  */
  2694.  
  2695.   if (flow_dump)
  2696.     TIMEVAR (dump_time,
  2697.          {
  2698.            print_rtl (flow_dump_file, insns);
  2699.            fflush (flow_dump_file);
  2700.          });
  2701.  
  2702.   /* If -opt, try combining insns through substitution.  */
  2703.  
  2704.   if (optimize > 0)
  2705.     TIMEVAR (combine_time, combine_instructions (insns, max_reg_num ()));
  2706.  
  2707.   /* Dump rtl code after insn combination.  */
  2708.  
  2709.   if (combine_dump)
  2710.     TIMEVAR (dump_time,
  2711.          {
  2712.            fprintf (combine_dump_file, "\n;; Function %s\n\n",
  2713.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2714.            dump_combine_stats (combine_dump_file);
  2715.            print_rtl (combine_dump_file, insns);
  2716.            fflush (combine_dump_file);
  2717.          });
  2718.  
  2719.   /* Print function header into sched dump now
  2720.      because doing the sched analysis makes some of the dump.  */
  2721.  
  2722.   if (sched_dump)
  2723.     TIMEVAR (dump_time,
  2724.          {
  2725.            fprintf (sched_dump_file, "\n;; Function %s\n\n",
  2726.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2727.          });
  2728.  
  2729.   if (optimize > 0 && flag_schedule_insns)
  2730.     {
  2731.       /* Do control and data sched analysis,
  2732.      and write some of the results to dump file.  */
  2733.  
  2734.       TIMEVAR (sched_time, schedule_insns (sched_dump_file));
  2735.     }
  2736.  
  2737.   /* Dump rtl after instruction scheduling.  */
  2738.  
  2739.   if (sched_dump)
  2740.     TIMEVAR (dump_time,
  2741.          {
  2742.            print_rtl (sched_dump_file, insns);
  2743.            fflush (sched_dump_file);
  2744.          });
  2745.  
  2746.   /* Unless we did stupid register allocation,
  2747.      allocate pseudo-regs that are used only within 1 basic block.  */
  2748.  
  2749.   if (!obey_regdecls)
  2750.     TIMEVAR (local_alloc_time,
  2751.          {
  2752.            regclass (insns, max_reg_num ());
  2753.            local_alloc ();
  2754.          });
  2755.  
  2756.   /* Dump rtl code after allocating regs within basic blocks.  */
  2757.  
  2758.   if (local_reg_dump)
  2759.     TIMEVAR (dump_time,
  2760.          {
  2761.            fprintf (local_reg_dump_file, "\n;; Function %s\n\n",
  2762.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2763.            dump_flow_info (local_reg_dump_file);
  2764.            dump_local_alloc (local_reg_dump_file);
  2765.            print_rtl (local_reg_dump_file, insns);
  2766.            fflush (local_reg_dump_file);
  2767.          });
  2768.  
  2769.   if (global_reg_dump)
  2770.     TIMEVAR (dump_time,
  2771.          fprintf (global_reg_dump_file, "\n;; Function %s\n\n",
  2772.               IDENTIFIER_POINTER (DECL_NAME (decl))));
  2773.  
  2774.   /* Unless we did stupid register allocation,
  2775.      allocate remaining pseudo-regs, then do the reload pass
  2776.      fixing up any insns that are invalid.  */
  2777.  
  2778.   TIMEVAR (global_alloc_time,
  2779.        {
  2780.          if (!obey_regdecls)
  2781.            failure = global_alloc (global_reg_dump_file);
  2782.          else
  2783.            failure = reload (insns, 0, global_reg_dump_file);
  2784.        });
  2785.  
  2786.   if (global_reg_dump)
  2787.     TIMEVAR (dump_time,
  2788.          {
  2789.            dump_global_regs (global_reg_dump_file);
  2790.            print_rtl (global_reg_dump_file, insns);
  2791.            fflush (global_reg_dump_file);
  2792.          });
  2793.  
  2794.   if (failure)
  2795.     goto exit_rest_of_compilation;
  2796.  
  2797.   reload_completed = 1;
  2798.  
  2799.   /* On some machines, the prologue and epilogue code, or parts thereof,
  2800.      can be represented as RTL.  Doing so lets us schedule insns between
  2801.      it and the rest of the code and also allows delayed branch
  2802.      scheduling to operate in the epilogue.  */
  2803.  
  2804.   thread_prologue_and_epilogue_insns (insns);
  2805.  
  2806.   if (optimize > 0 && flag_schedule_insns_after_reload)
  2807.     {
  2808.       if (sched2_dump)
  2809.     TIMEVAR (dump_time,
  2810.          {
  2811.            fprintf (sched2_dump_file, "\n;; Function %s\n\n",
  2812.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  2813.          });
  2814.  
  2815.       /* Do control and data sched analysis again,
  2816.      and write some more of the results to dump file.  */
  2817.  
  2818.       TIMEVAR (sched2_time, schedule_insns (sched2_dump_file));
  2819.  
  2820.       /* Dump rtl after post-reorder instruction scheduling.  */
  2821.  
  2822.       if (sched2_dump)
  2823.     TIMEVAR (dump_time,
  2824.          {
  2825.            print_rtl (sched2_dump_file, insns);
  2826.            fflush (sched2_dump_file);
  2827.          });
  2828.     }
  2829.  
  2830. #ifdef LEAF_REGISTERS
  2831.   leaf_function = 0;
  2832.   if (optimize > 0 && only_leaf_regs_used () && leaf_function_p ())
  2833.     leaf_function = 1;
  2834. #endif
  2835.  
  2836.   /* One more attempt to remove jumps to .+1
  2837.      left by dead-store-elimination.
  2838.      Also do cross-jumping this time
  2839.      and delete no-op move insns.  */
  2840.  
  2841.   if (optimize > 0)
  2842.     {
  2843.       TIMEVAR (jump_time, jump_optimize (insns, 1, 1, 0));
  2844.     }
  2845.  
  2846.   /* Dump rtl code after jump, if we are doing that.  */
  2847.  
  2848.   if (jump2_opt_dump)
  2849.     TIMEVAR (dump_time,
  2850.          {
  2851.            fprintf (jump2_opt_dump_file, "\n;; Function %s\n\n",
  2852.             IDENTIFIER_POINTER (DECL_NAME (decl)));
  2853.            print_rtl (jump2_opt_dump_file, insns);
  2854.            fflush (jump2_opt_dump_file);
  2855.          });
  2856.  
  2857.   /* If a scheduling pass for delayed branches is to be done,
  2858.      call the scheduling code. */
  2859.  
  2860. #ifdef DELAY_SLOTS
  2861.   if (optimize > 0 && flag_delayed_branch)
  2862.     {
  2863.       TIMEVAR (dbr_sched_time, dbr_schedule (insns, dbr_sched_dump_file));
  2864.       if (dbr_sched_dump)
  2865.     {
  2866.       TIMEVAR (dump_time,
  2867.          {
  2868.            fprintf (dbr_sched_dump_file, "\n;; Function %s\n\n",
  2869.                 IDENTIFIER_POINTER (DECL_NAME (decl)));
  2870.            print_rtl (dbr_sched_dump_file, insns);
  2871.            fflush (dbr_sched_dump_file);
  2872.          });
  2873.     }
  2874.     }
  2875. #endif
  2876.  
  2877.   if (optimize > 0)
  2878.     /* Shorten branches.  */
  2879.     TIMEVAR (shorten_branch_time,
  2880.          {
  2881.            shorten_branches (get_insns ());
  2882.          });
  2883.  
  2884. #ifdef STACK_REGS
  2885.   TIMEVAR (stack_reg_time, reg_to_stack (insns, stack_reg_dump_file));
  2886.   if (stack_reg_dump)
  2887.     {
  2888.       TIMEVAR (dump_time,
  2889.            {
  2890.          fprintf (stack_reg_dump_file, "\n;; Function %s\n\n",
  2891.               IDENTIFIER_POINTER (DECL_NAME (decl)));
  2892.          print_rtl (stack_reg_dump_file, insns);
  2893.          fflush (stack_reg_dump_file);
  2894.            });
  2895.     }
  2896. #endif
  2897.  
  2898.   /* Now turn the rtl into assembler code.  */
  2899.  
  2900.   TIMEVAR (final_time,
  2901.        {
  2902.          rtx x;
  2903.          char *fnname;
  2904.  
  2905.          /* Get the function's name, as described by its RTL.
  2906.         This may be different from the DECL_NAME name used
  2907.         in the source file.  */
  2908.  
  2909.          x = DECL_RTL (decl);
  2910.          if (GET_CODE (x) != MEM)
  2911.            abort ();
  2912.          x = XEXP (x, 0);
  2913.          if (GET_CODE (x) != SYMBOL_REF)
  2914.            abort ();
  2915.          fnname = XSTR (x, 0);
  2916.  
  2917.          assemble_start_function (decl, fnname);
  2918.          final_start_function (insns, asm_out_file, optimize);
  2919.          final (insns, asm_out_file, optimize, 0);
  2920.          final_end_function (insns, asm_out_file, optimize);
  2921.          assemble_end_function (decl, fnname);
  2922.          fflush (asm_out_file);
  2923.        });
  2924.  
  2925.   /* Write DBX symbols if requested */
  2926.  
  2927.   /* Note that for those inline functions where we don't initially
  2928.      know for certain that we will be generating an out-of-line copy,
  2929.      the first invocation of this routine (rest_of_compilation) will
  2930.      skip over this code by doing a `goto exit_rest_of_compilation;'.
  2931.      Later on, finish_compilation will call rest_of_compilation again
  2932.      for those inline functions that need to have out-of-line copies
  2933.      generated.  During that call, we *will* be routed past here.  */
  2934.  
  2935. #ifdef DBX_DEBUGGING_INFO
  2936.   if (write_symbols == DBX_DEBUG)
  2937.     TIMEVAR (symout_time, dbxout_function (decl));
  2938. #endif
  2939.  
  2940. #ifdef DWARF_DEBUGGING_INFO
  2941.   if (write_symbols == DWARF_DEBUG)
  2942.     TIMEVAR (symout_time, dwarfout_file_scope_decl (decl, 0));
  2943. #endif
  2944.  
  2945.  exit_rest_of_compilation:
  2946.  
  2947.   /* In case the function was not output,
  2948.      don't leave any temporary anonymous types
  2949.      queued up for sdb output.  */
  2950. #ifdef SDB_DEBUGGING_INFO
  2951.   if (write_symbols == SDB_DEBUG)
  2952.     sdbout_types (NULL_TREE);
  2953. #endif
  2954.  
  2955.   /* Put back the tree of subblocks and list of arguments
  2956.      from before we copied them.
  2957.      Code generation and the output of debugging info may have modified
  2958.      the copy, but the original is unchanged.  */
  2959.  
  2960.   if (saved_block_tree != 0)
  2961.     DECL_INITIAL (decl) = saved_block_tree;
  2962.   if (saved_arguments != 0)
  2963.     DECL_ARGUMENTS (decl) = saved_arguments;
  2964.  
  2965.   reload_completed = 0;
  2966.  
  2967.   /* Clear out the real_constant_chain before some of the rtx's
  2968.      it runs through become garbage.  */
  2969.  
  2970.   clear_const_double_mem ();
  2971.  
  2972.   /* Cancel the effect of rtl_in_current_obstack.  */
  2973.  
  2974.   resume_temporary_allocation ();
  2975.  
  2976.   /* The parsing time is all the time spent in yyparse
  2977.      *except* what is spent in this function.  */
  2978.  
  2979.   parse_time -= get_run_time () - start_time;
  2980. }
  2981.  
  2982. /* Entry point of cc1/c++.  Decode command args, then call compile_file.
  2983.    Exit code is 35 if can't open files, 34 if fatal error,
  2984.    33 if had nonfatal errors, else success.  */
  2985.  
  2986. int
  2987. main (argc, argv, envp)
  2988.      int argc;
  2989.      char **argv;
  2990.      char **envp;
  2991. {
  2992.   register int i;
  2993.   char *filename = 0;
  2994.   int flag_print_mem = 0;
  2995.   int version_flag = 0;
  2996.   char *p;
  2997.  
  2998. #ifdef atarist
  2999. /* turn this on if you are going to set the TOS 1.4 dont clear heap flag */
  3000. /*  _malloczero(1); */     /* zero mallocs by default */
  3001. #endif  
  3002.  
  3003.   /* save in case md file wants to emit args as a comment.  */
  3004.   save_argc = argc;
  3005.   save_argv = argv;
  3006.  
  3007.   p = argv[0] + strlen (argv[0]);
  3008. #ifndef atarist
  3009.   while (p != argv[0] && p[-1] != '/') --p;
  3010. #else
  3011.   while (p != argv[0] && ((p[-1] != '/') && (p[-1] != '\\') &&
  3012.               (p[-1] != ':'))) --p;
  3013. #endif
  3014.   progname = p;
  3015.  
  3016. #ifdef RLIMIT_STACK
  3017.   /* Get rid of any avoidable limit on stack size.  */
  3018.   {
  3019.     struct rlimit rlim;
  3020.  
  3021.     /* Set the stack limit huge so that alloca does not fail. */
  3022.     getrlimit (RLIMIT_STACK, &rlim);
  3023.     rlim.rlim_cur = rlim.rlim_max;
  3024.     setrlimit (RLIMIT_STACK, &rlim);
  3025.   }
  3026. #endif /* RLIMIT_STACK */
  3027.  
  3028.   signal (SIGFPE, float_signal);
  3029.  
  3030. #ifndef atarist
  3031. #ifdef SIGPIPE
  3032.   signal (SIGPIPE, pipe_closed);
  3033. #endif
  3034. #endif
  3035.  
  3036.   decl_printable_name = decl_name;
  3037.   lang_expand_expr = (struct rtx_def *(*)()) do_abort;
  3038.  
  3039.   /* Initialize whether `char' is signed.  */
  3040.   flag_signed_char = DEFAULT_SIGNED_CHAR;
  3041. #ifdef DEFAULT_SHORT_ENUMS
  3042.   /* Initialize how much space enums occupy, by default.  */
  3043.   flag_short_enums = DEFAULT_SHORT_ENUMS;
  3044. #endif
  3045.  
  3046.   /* Scan to see what optimization level has been specified.  That will
  3047.      determine the default value of many flags.  */
  3048.   for (i = 1; i < argc; i++)
  3049.     {
  3050.       if (!strcmp (argv[i], "-O"))
  3051.     {
  3052.       optimize = 1;
  3053.     }
  3054.       else if (argv[i][0] == '-' && argv[i][1] == 'O')
  3055.     {
  3056.       /* Handle -O2, -O3, -O69, ...  */
  3057.       char *p = &argv[i][2];
  3058.       int c;
  3059.  
  3060.       while (c = *p++)
  3061.         if (! (c >= '0' && c <= '9'))
  3062.           break;
  3063.       if (c == 0)
  3064.         optimize = atoi (&argv[i][2]);
  3065.     }
  3066.     }
  3067.  
  3068.   obey_regdecls = (optimize == 0);
  3069.   if (optimize == 0)
  3070.     {
  3071.       flag_no_inline = 1;
  3072.       warn_inline = 0;
  3073.     }
  3074.  
  3075.   if (optimize >= 1)
  3076.     {
  3077.       flag_defer_pop = 1;
  3078.       flag_thread_jumps = 1;
  3079. #ifdef DELAY_SLOTS
  3080.       flag_delayed_branch = 1;
  3081. #endif
  3082.     }
  3083.  
  3084.   if (optimize >= 2)
  3085.     {
  3086.       flag_cse_follow_jumps = 1;
  3087.       flag_cse_skip_blocks = 1;
  3088.       flag_expensive_optimizations = 1;
  3089.       flag_strength_reduce = 1;
  3090.       flag_rerun_cse_after_loop = 1;
  3091.       flag_caller_saves = 1;
  3092. #ifdef INSN_SCHEDULING
  3093.       flag_schedule_insns = 1;
  3094.       flag_schedule_insns_after_reload = 1;
  3095. #endif
  3096.     }
  3097.  
  3098. #ifdef OPTIMIZATION_OPTIONS
  3099.   /* Allow default optimizations to be specified on a per-machine basis.  */
  3100.   OPTIMIZATION_OPTIONS (optimize);
  3101. #endif
  3102.  
  3103.   /* Initialize register usage now so switches may override.  */
  3104.   init_reg_sets ();
  3105.  
  3106.   target_flags = 0;
  3107.   set_target_switch ("");
  3108.  
  3109.   for (i = 1; i < argc; i++)
  3110.     {
  3111.       int j;
  3112.       /* If this is a language-specific option,
  3113.      decode it in a language-specific way.  */
  3114.       for (j = 0; lang_options[j] != 0; j++)
  3115.     if (!strncmp (argv[i], lang_options[j],
  3116.               strlen (lang_options[j])))
  3117.       break;
  3118.       if (lang_options[j] != 0)
  3119.     /* If the option is valid for *some* language,
  3120.        treat it as valid even if this language doesn't understand it.  */
  3121.     lang_decode_option (argv[i]);
  3122.       else if (argv[i][0] == '-' && argv[i][1] != 0)
  3123.     {
  3124.       register char *str = argv[i] + 1;
  3125.       if (str[0] == 'Y')
  3126.         str++;
  3127.  
  3128.       if (str[0] == 'm')
  3129.         set_target_switch (&str[1]);
  3130.       else if (!strcmp (str, "dumpbase"))
  3131.         {
  3132.           dump_base_name = argv[++i];
  3133. #ifdef atarist
  3134.           /* dump_base_name will typically be 'foo.c' here.
  3135.              Need to truncate at the '.', cause dots mean 
  3136.              something here
  3137.            */
  3138.               {
  3139.               char * n = dump_base_name;
  3140.           for ( ; ((*n) && (*n != '.')) ; )
  3141.                       n++;
  3142.                   *n = '\0';
  3143.           }
  3144. #endif
  3145.         }
  3146.       else if (str[0] == 'd')
  3147.         {
  3148.           register char *p = &str[1];
  3149.           while (*p)
  3150.         switch (*p++)
  3151.           {
  3152.            case 'a':
  3153.              combine_dump = 1;
  3154.              dbr_sched_dump = 1;
  3155.              flow_dump = 1;
  3156.              global_reg_dump = 1;
  3157.              jump_opt_dump = 1;
  3158.              jump2_opt_dump = 1;
  3159.              local_reg_dump = 1;
  3160.              loop_dump = 1;
  3161.              rtl_dump = 1;
  3162.              cse_dump = 1, cse2_dump = 1;
  3163.              sched_dump = 1;
  3164.              sched2_dump = 1;
  3165.             stack_reg_dump = 1;
  3166.             break;
  3167.           case 'k':
  3168.             stack_reg_dump = 1;
  3169.             break;
  3170.           case 'c':
  3171.             combine_dump = 1;
  3172.             break;
  3173.           case 'd':
  3174.             dbr_sched_dump = 1;
  3175.             break;
  3176.           case 'f':
  3177.             flow_dump = 1;
  3178.             break;
  3179.           case 'g':
  3180.             global_reg_dump = 1;
  3181.             break;
  3182.           case 'j':
  3183.             jump_opt_dump = 1;
  3184.             break;
  3185.           case 'J':
  3186.             jump2_opt_dump = 1;
  3187.             break;
  3188.           case 'l':
  3189.             local_reg_dump = 1;
  3190.             break;
  3191.           case 'L':
  3192.             loop_dump = 1;
  3193.             break;
  3194.           case 'm':
  3195.             flag_print_mem = 1;
  3196.             break;
  3197.           case 'p':
  3198.             flag_print_asm_name = 1;
  3199.             break;
  3200.           case 'r':
  3201.             rtl_dump = 1;
  3202.             break;
  3203.           case 's':
  3204.             cse_dump = 1;
  3205.             break;
  3206.           case 't':
  3207.             cse2_dump = 1;
  3208.             break;
  3209.           case 'S':
  3210.             sched_dump = 1;
  3211.             break;
  3212.           case 'R':
  3213.             sched2_dump = 1;
  3214.             break;
  3215.           case 'y':
  3216.             set_yydebug (1);
  3217.             break;
  3218.  
  3219.           case 'x':
  3220.             rtl_dump_and_exit = 1;
  3221.             break;
  3222.           }
  3223.         }
  3224.       else if (str[0] == 'f')
  3225.         {
  3226.           register char *p = &str[1];
  3227.           int found = 0;
  3228.  
  3229.           /* Some kind of -f option.
  3230.          P's value is the option sans `-f'.
  3231.          Search for it in the table of options.  */
  3232.  
  3233.           for (j = 0;
  3234.            !found && j < sizeof (f_options) / sizeof (f_options[0]);
  3235.            j++)
  3236.         {
  3237.           if (!strcmp (p, f_options[j].string))
  3238.             {
  3239.               *f_options[j].variable = f_options[j].on_value;
  3240.               /* A goto here would be cleaner,
  3241.              but breaks the vax pcc.  */
  3242.               found = 1;
  3243.             }
  3244.           if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  3245.               && ! strcmp (p+3, f_options[j].string))
  3246.             {
  3247.               *f_options[j].variable = ! f_options[j].on_value;
  3248.               found = 1;
  3249.             }
  3250.         }
  3251.  
  3252.           if (found)
  3253.         ;
  3254.           else if (!strncmp (p, "fixed-", 6))
  3255.         fix_register (&p[6], 1, 1);
  3256.           else if (!strncmp (p, "call-used-", 10))
  3257.         fix_register (&p[10], 0, 1);
  3258.           else if (!strncmp (p, "call-saved-", 11))
  3259.         fix_register (&p[11], 0, 0);
  3260.           else
  3261.         error ("Invalid option `%s'", argv[i]);
  3262.         }
  3263.       else if (str[0] == 'O')
  3264.         {
  3265.           register char *p = str+1;
  3266.           while (*p && *p >= '0' && *p <= '9')
  3267.         p++;
  3268.           if (*p == '\0')
  3269.         ;
  3270.           else
  3271.         error ("Invalid option `%s'", argv[i]);
  3272.         }
  3273.       else if (!strcmp (str, "pedantic"))
  3274.         pedantic = 1;
  3275.       else if (!strcmp (str, "pedantic-errors"))
  3276.         flag_pedantic_errors = pedantic = 1;
  3277.       else if (!strcmp (str, "quiet"))
  3278.         quiet_flag = 1;
  3279.       else if (!strcmp (str, "version"))
  3280.         version_flag = 1;
  3281.       else if (!strcmp (str, "w"))
  3282.         inhibit_warnings = 1;
  3283.       else if (!strcmp (str, "W"))
  3284.         {
  3285.           extra_warnings = 1;
  3286.           /* We save the value of warn_uninitialized, since if they put
  3287.          -Wuninitialized on the command line, we need to generate a
  3288.          warning about not using it without also specifying -O.  */
  3289.           if (warn_uninitialized != 1)
  3290.         warn_uninitialized = 2;
  3291.         }
  3292.       else if (str[0] == 'W')
  3293.         {
  3294.           register char *p = &str[1];
  3295.           int found = 0;
  3296.  
  3297.           /* Some kind of -W option.
  3298.          P's value is the option sans `-W'.
  3299.          Search for it in the table of options.  */
  3300.  
  3301.           for (j = 0;
  3302.            !found && j < sizeof (W_options) / sizeof (W_options[0]);
  3303.            j++)
  3304.         {
  3305.           if (!strcmp (p, W_options[j].string))
  3306.             {
  3307.               *W_options[j].variable = W_options[j].on_value;
  3308.               /* A goto here would be cleaner,
  3309.              but breaks the vax pcc.  */
  3310.               found = 1;
  3311.             }
  3312.           if (p[0] == 'n' && p[1] == 'o' && p[2] == '-'
  3313.               && ! strcmp (p+3, W_options[j].string))
  3314.             {
  3315.               *W_options[j].variable = ! W_options[j].on_value;
  3316.               found = 1;
  3317.             }
  3318.         }
  3319.  
  3320.           if (found)
  3321.         ;
  3322.           else if (!strncmp (p, "id-clash-", 9))
  3323.         {
  3324.           char *endp = p + 9;
  3325.  
  3326.           while (*endp)
  3327.             {
  3328.               if (*endp >= '0' && *endp <= '9')
  3329.             endp++;
  3330.               else
  3331.             {
  3332.               error ("Invalid option `%s'", argv[i]);
  3333.               goto id_clash_lose;
  3334.             }
  3335.             }
  3336.           warn_id_clash = 1;
  3337.           id_clash_len = atoi (str + 10);
  3338.         id_clash_lose: ;
  3339.         }
  3340.           else
  3341.         error ("Invalid option `%s'", argv[i]);
  3342.         }
  3343.       else if (!strcmp (str, "p"))
  3344.         {
  3345.           if (!output_bytecode)
  3346.         profile_flag = 1;
  3347.           else
  3348.         error ("profiling not supported in bytecode compilation");
  3349.         }
  3350.       else if (!strcmp (str, "a"))
  3351.         {
  3352. #if !defined (BLOCK_PROFILER) || !defined (FUNCTION_BLOCK_PROFILER)
  3353.           warning ("`-a' option (basic block profile) not supported");
  3354. #else
  3355.           profile_block_flag = 1;
  3356. #endif
  3357.         }
  3358.       else if (str[0] == 'g')
  3359.         {
  3360.           char *p = str + 1;
  3361.           char *q;
  3362.           unsigned len;
  3363.           unsigned level;
  3364.  
  3365.           while (*p && (*p < '0' || *p > '9'))
  3366.         p++;
  3367.           len = p - str;
  3368.           q = p;
  3369.           while (*q && (*q >= '0' && *q <= '9'))
  3370.         q++;
  3371.           if (*p)
  3372.         level = atoi (p);
  3373.           else
  3374.         level = 2;    /* default debugging info level */
  3375.           if (*q || level > 3)
  3376.         {
  3377.           warning ("invalid debug level specification in option: `-%s'",
  3378.                str);
  3379.           warning ("no debugging information will be generated");
  3380.           level = 0;
  3381.         }
  3382.  
  3383.           /* If more than one debugging type is supported,
  3384.          you must define PREFERRED_DEBUGGING_TYPE
  3385.          to choose a format in a system-dependent way.  */
  3386.           /* This is one long line cause VAXC can't handle a \-newline.  */
  3387. #if 1 < (defined (DBX_DEBUGGING_INFO) + defined (SDB_DEBUGGING_INFO) + defined (DWARF_DEBUGGING_INFO) + defined (XCOFF_DEBUGGING_INFO))
  3388. #ifdef PREFERRED_DEBUGGING_TYPE
  3389.           if (!strncmp (str, "ggdb", len))
  3390.         write_symbols = PREFERRED_DEBUGGING_TYPE;
  3391. #else /* no PREFERRED_DEBUGGING_TYPE */
  3392. You Lose!  You must define PREFERRED_DEBUGGING_TYPE!
  3393. #endif /* no PREFERRED_DEBUGGING_TYPE */
  3394. #endif /* More than one debugger format enabled.  */
  3395. #ifdef DBX_DEBUGGING_INFO
  3396.           if (write_symbols != NO_DEBUG)
  3397.         ;
  3398.           else if (!strncmp (str, "ggdb", len))
  3399.         write_symbols = DBX_DEBUG;
  3400.           else if (!strncmp (str, "gstabs", len))
  3401.         write_symbols = DBX_DEBUG;
  3402.           else if (!strncmp (str, "gstabs+", len))
  3403.         write_symbols = DBX_DEBUG;
  3404.  
  3405.           /* Always enable extensions for -ggdb or -gstabs+, 
  3406.          always disable for -gstabs.
  3407.          For plain -g, use system-specific default.  */
  3408.           if (write_symbols == DBX_DEBUG && !strncmp (str, "ggdb", len)
  3409.           && len >= 2)
  3410.         use_gnu_debug_info_extensions = 1;
  3411.           else if (write_symbols == DBX_DEBUG && !strncmp (str, "gstabs+", len)
  3412.                && len >= 7)
  3413.         use_gnu_debug_info_extensions = 1;
  3414.           else if (write_symbols == DBX_DEBUG
  3415.                && !strncmp (str, "gstabs", len) && len >= 2)
  3416.         use_gnu_debug_info_extensions = 0;
  3417.           else
  3418.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3419. #endif /* DBX_DEBUGGING_INFO */
  3420. #ifdef DWARF_DEBUGGING_INFO
  3421.           if (write_symbols != NO_DEBUG)
  3422.         ;
  3423.           else if (!strncmp (str, "g", len))
  3424.         write_symbols = DWARF_DEBUG;
  3425.           else if (!strncmp (str, "ggdb", len))
  3426.         write_symbols = DWARF_DEBUG;
  3427.           else if (!strncmp (str, "gdwarf", len))
  3428.         write_symbols = DWARF_DEBUG;
  3429.  
  3430.           /* Always enable extensions for -ggdb or -gdwarf+, 
  3431.          always disable for -gdwarf.
  3432.          For plain -g, use system-specific default.  */
  3433.           if (write_symbols == DWARF_DEBUG && !strncmp (str, "ggdb", len)
  3434.           && len >= 2)
  3435.         use_gnu_debug_info_extensions = 1;
  3436.           else if (write_symbols == DWARF_DEBUG && !strcmp (str, "gdwarf+"))
  3437.         use_gnu_debug_info_extensions = 1;
  3438.           else if (write_symbols == DWARF_DEBUG
  3439.                && !strncmp (str, "gdwarf", len) && len >= 2)
  3440.         use_gnu_debug_info_extensions = 0;
  3441.           else
  3442.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3443. #endif
  3444. #ifdef SDB_DEBUGGING_INFO
  3445.           if (write_symbols != NO_DEBUG)
  3446.         ;
  3447.           else if (!strncmp (str, "g", len))
  3448.         write_symbols = SDB_DEBUG;
  3449.           else if (!strncmp (str, "gdb", len))
  3450.         write_symbols = SDB_DEBUG;
  3451.           else if (!strncmp (str, "gcoff", len))
  3452.         write_symbols = SDB_DEBUG;
  3453. #endif /* SDB_DEBUGGING_INFO */
  3454. #ifdef XCOFF_DEBUGGING_INFO
  3455.           if (write_symbols != NO_DEBUG)
  3456.         ;
  3457.           else if (!strncmp (str, "g", len))
  3458.         write_symbols = XCOFF_DEBUG;
  3459.           else if (!strncmp (str, "ggdb", len))
  3460.         write_symbols = XCOFF_DEBUG;
  3461.           else if (!strncmp (str, "gxcoff", len))
  3462.         write_symbols = XCOFF_DEBUG;
  3463.  
  3464.           /* Always enable extensions for -ggdb or -gxcoff+,
  3465.          always disable for -gxcoff.
  3466.          For plain -g, use system-specific default.  */
  3467.           if (write_symbols == XCOFF_DEBUG && !strncmp (str, "ggdb", len)
  3468.           && len >= 2)
  3469.         use_gnu_debug_info_extensions = 1;
  3470.           else if (write_symbols == XCOFF_DEBUG && !strcmp (str, "gxcoff+"))
  3471.         use_gnu_debug_info_extensions = 1;
  3472.           else if (write_symbols == XCOFF_DEBUG
  3473.                && !strncmp (str, "gxcoff", len) && len >= 2)
  3474.         use_gnu_debug_info_extensions = 0;
  3475.           else
  3476.         use_gnu_debug_info_extensions = DEFAULT_GDB_EXTENSIONS;
  3477. #endif          
  3478.           if (write_symbols == NO_DEBUG)
  3479.         warning ("`-%s' option not supported on this version of GCC", str);
  3480.           else if (level == 0)
  3481.         write_symbols = NO_DEBUG;
  3482.           else
  3483.         debug_info_level = (enum debug_info_level) level;
  3484.         }
  3485.       else if (!strcmp (str, "o"))
  3486.         {
  3487.           asm_file_name = argv[++i];
  3488.         }
  3489.       else if (str[0] == 'G')
  3490.         {
  3491.           g_switch_set = TRUE;
  3492.           g_switch_value = atoi ((str[1] != '\0') ? str+1 : argv[++i]);
  3493.         }
  3494.       else if (!strncmp (str, "aux-info", 8))
  3495.         {
  3496.           flag_gen_aux_info = 1;
  3497.           aux_info_file_name = (str[8] != '\0' ? str+8 : argv[++i]);
  3498.         }
  3499.       else
  3500.         error ("Invalid option `%s'", argv[i]);
  3501.     }
  3502.       else if (argv[i][0] == '+')
  3503.     error ("Invalid option `%s'", argv[i]);
  3504.       else
  3505.     filename = argv[i];
  3506.     }
  3507.  
  3508.   /* Initialize for bytecode output.  A good idea to do this as soon as
  3509.      possible after the "-f" options have been parsed. */
  3510.   if (output_bytecode)
  3511.     {
  3512. #ifndef TARGET_SUPPORTS_BYTECODE
  3513.       /* Just die with a fatal error if not supported */
  3514.       fatal ("-fbytecode can not be used for this target");
  3515. #else
  3516.       bc_initialize ();
  3517. #endif
  3518.     }
  3519.  
  3520.   if (optimize == 0)
  3521.     {
  3522.       /* Inlining does not work if not optimizing,
  3523.      so force it not to be done.  */
  3524.       flag_no_inline = 1;
  3525.       warn_inline = 0;
  3526.  
  3527.       /* The c_decode_option and lang_decode_option functions set
  3528.      this to `2' if -Wall is used, so we can avoid giving out
  3529.      lots of errors for people who don't realize what -Wall does.  */
  3530.       if (warn_uninitialized == 1)
  3531.     warning ("-Wuninitialized is not supported without -O");
  3532.     }
  3533.  
  3534. #if defined(DWARF_DEBUGGING_INFO)
  3535.   if (write_symbols == DWARF_DEBUG
  3536.       && strcmp (language_string, "GNU C++") == 0)
  3537.     {
  3538.       warning ("-g option not supported for C++ on SVR4 systems");
  3539.       write_symbols = NO_DEBUG;
  3540.     }
  3541. #endif /* defined(DWARF_DEBUGGING_INFO) */
  3542.  
  3543. #ifdef OVERRIDE_OPTIONS
  3544.   /* Some machines may reject certain combinations of options.  */
  3545.   OVERRIDE_OPTIONS;
  3546. #endif
  3547.  
  3548.   /* Unrolling all loops implies that standard loop unrolling must also
  3549.      be done.  */
  3550.   if (flag_unroll_all_loops)
  3551.     flag_unroll_loops = 1;
  3552.   /* Loop unrolling requires that strength_reduction be on also.  Silently
  3553.      turn on strength reduction here if it isn't already on.  Also, the loop
  3554.      unrolling code assumes that cse will be run after loop, so that must
  3555.      be turned on also.  */
  3556.   if (flag_unroll_loops)
  3557.     {
  3558.       flag_strength_reduce = 1;
  3559.       flag_rerun_cse_after_loop = 1;
  3560.     }
  3561.  
  3562.   /* Warn about options that are not supported on this machine.  */
  3563. #ifndef INSN_SCHEDULING
  3564.   if (flag_schedule_insns || flag_schedule_insns_after_reload)
  3565.     warning ("instruction scheduling not supported on this target machine");
  3566. #endif
  3567. #ifndef DELAY_SLOTS
  3568.   if (flag_delayed_branch)
  3569.     warning ("this target machine does not have delayed branches");
  3570. #endif
  3571.  
  3572.   /* If we are in verbose mode, write out the version and maybe all the
  3573.      option flags in use.  */
  3574.   if (version_flag)
  3575.     {
  3576. #if (defined(atarist) || defined(CROSSATARI) || defined(atariminix))
  3577. #include "PatchLev.h"
  3578.         fprintf (stderr, "%s version %s-atariST Patchlevel %s",
  3579.          language_string, version_string, PatchLevel);
  3580. #else
  3581.       fprintf (stderr, "%s version %s", language_string, version_string);
  3582. #endif
  3583. #ifdef TARGET_VERSION
  3584.       TARGET_VERSION;
  3585. #endif
  3586. #ifdef __GNUC__
  3587. #ifndef __VERSION__
  3588. #define __VERSION__ "[unknown]"
  3589. #endif
  3590.       fprintf (stderr, " compiled by GNU C version %s.\n", __VERSION__);
  3591. #else
  3592.       fprintf (stderr, " compiled by CC.\n");
  3593. #endif
  3594.       if (! quiet_flag)
  3595.     print_switch_values ();
  3596.     }
  3597.  
  3598.   /* Now that register usage is specified, convert it to HARD_REG_SETs.  */
  3599.   if (!output_bytecode)
  3600.     init_reg_sets_1 ();
  3601.  
  3602.   compile_file (filename);
  3603.  
  3604.   if (output_bytecode)
  3605.     bc_write_file (stdout);
  3606.  
  3607. #if (!(defined(atarist) || defined(atariminix)))
  3608. #if (!(defined(CROSSHPUX)))
  3609. #ifndef OS2
  3610. #ifndef VMS
  3611.   if (flag_print_mem)
  3612.     {
  3613.       char *lim = (char *) sbrk (0);
  3614.  
  3615.       fprintf (stderr, "Data size %d.\n",
  3616.            lim - (char *) &environ);
  3617.       fflush (stderr);
  3618.  
  3619. #ifdef USG
  3620.       system ("ps -l 1>&2");
  3621. #else /* not USG */
  3622.       system ("ps v");
  3623. #endif /* not USG */
  3624.     }
  3625. #endif /* not VMS */
  3626. #endif /* not OS2 */
  3627. #endif
  3628. #endif
  3629.  
  3630.   if (errorcount)
  3631.     exit (FATAL_EXIT_CODE);
  3632.   if (sorrycount)
  3633.     exit (FATAL_EXIT_CODE);
  3634.   exit (SUCCESS_EXIT_CODE);
  3635.   return 34;
  3636. }
  3637.  
  3638. /* Decode -m switches.  */
  3639.  
  3640. /* Here is a table, controlled by the tm.h file, listing each -m switch
  3641.    and which bits in `target_switches' it should set or clear.
  3642.    If VALUE is positive, it is bits to set.
  3643.    If VALUE is negative, -VALUE is bits to clear.
  3644.    (The sign bit is not used so there is no confusion.)  */
  3645.  
  3646. struct {char *name; int value;} target_switches []
  3647.   = TARGET_SWITCHES;
  3648.  
  3649. /* This table is similar, but allows the switch to have a value.  */
  3650.  
  3651. #ifdef TARGET_OPTIONS
  3652. struct {char *prefix; char ** variable;} target_options []
  3653.   = TARGET_OPTIONS;
  3654. #endif
  3655.  
  3656. /* Decode the switch -mNAME.  */
  3657.  
  3658. void
  3659. set_target_switch (name)
  3660.      char *name;
  3661. {
  3662.   register int j;
  3663.   int valid = 0;
  3664.  
  3665.   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  3666.     if (!strcmp (target_switches[j].name, name))
  3667.       {
  3668.     if (target_switches[j].value < 0)
  3669.       target_flags &= ~-target_switches[j].value;
  3670.     else
  3671.       target_flags |= target_switches[j].value;
  3672.     valid = 1;
  3673.       }
  3674.  
  3675. #ifdef TARGET_OPTIONS
  3676.   if (!valid)
  3677.     for (j = 0; j < sizeof target_options / sizeof target_options[0]; j++)
  3678.       {
  3679.     int len = strlen (target_options[j].prefix);
  3680.     if (!strncmp (target_options[j].prefix, name, len))
  3681.       {
  3682.         *target_options[j].variable = name + len;
  3683.         valid = 1;
  3684.       }
  3685.       }
  3686. #endif
  3687.  
  3688.   if (!valid)
  3689.     error ("Invalid option `%s'", name);
  3690. }
  3691.  
  3692. /* Variable used for communication between the following two routines.  */
  3693.  
  3694. static int line_position;
  3695.  
  3696. /* Print an option value and adjust the position in the line.  */
  3697.  
  3698. static void
  3699. print_single_switch (type, name)
  3700.      char *type, *name;
  3701. {
  3702.   fprintf (stderr, " %s%s", type, name);
  3703.  
  3704.   line_position += strlen (type) + strlen (name) + 1;
  3705.  
  3706.   if (line_position > 65)
  3707.     {
  3708.       fprintf (stderr, "\n\t");
  3709.       line_position = 8;
  3710.     }
  3711. }
  3712.      
  3713. /* Print default target switches for -version.  */
  3714.  
  3715. static void
  3716. print_switch_values ()
  3717. {
  3718.   register int j;
  3719.  
  3720.   fprintf (stderr, "enabled:");
  3721.   line_position = 8;
  3722.  
  3723.   for (j = 0; j < sizeof f_options / sizeof f_options[0]; j++)
  3724.     if (*f_options[j].variable == f_options[j].on_value)
  3725.       print_single_switch ("-f", f_options[j].string);
  3726.  
  3727.   for (j = 0; j < sizeof W_options / sizeof W_options[0]; j++)
  3728.     if (*W_options[j].variable == W_options[j].on_value)
  3729.       print_single_switch ("-W", W_options[j].string);
  3730.  
  3731.   for (j = 0; j < sizeof target_switches / sizeof target_switches[0]; j++)
  3732.     if (target_switches[j].name[0] != '\0'
  3733.     && target_switches[j].value > 0
  3734.     && ((target_switches[j].value & target_flags)
  3735.         == target_switches[j].value))
  3736.       print_single_switch ("-m", target_switches[j].name);
  3737.  
  3738.   fprintf (stderr, "\n");
  3739. }
  3740.  
  3741. #ifdef atarist
  3742. #include <string.h>
  3743.  
  3744. char *atari_filename_nondirectory(p)
  3745. char *p;
  3746. {
  3747.     char *s;
  3748.     
  3749.     for(s = p + strlen(p); s != p; --s)
  3750.     {
  3751.     if((*s == '/') || (*s == '\\'))
  3752.         break;
  3753.     }
  3754.     
  3755.     return (s == p) ? p : s+1;
  3756. }
  3757.  
  3758. #endif
  3759.